mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 07:52:16 +00:00
Merge branch 'feature-68386/Access_the_FilterComponent_without_Permission_breaks_all_Filters'
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2022 fhcomplete.org
|
||||
* Copyright (C) 2025 fhcomplete.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -177,7 +177,7 @@ class FilterCmptLib
|
||||
$session = $this->getSession();
|
||||
|
||||
// If session is NOT empty -> a filter was already loaded
|
||||
if ($session != null)
|
||||
if (!isError($session) && $session != null)
|
||||
{
|
||||
// Retrieve the filterId stored in the session
|
||||
$sessionFilterId = $this->_getSessionElement(FilterCmptLib::FILTER_ID);
|
||||
@@ -219,9 +219,7 @@ class FilterCmptLib
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the session is empty -> first time that this filter is loaded
|
||||
if ($session == null)
|
||||
else
|
||||
{
|
||||
// Load filter definition data from DB
|
||||
$definition = $this->_loadDefinition(
|
||||
@@ -602,7 +600,7 @@ class FilterCmptLib
|
||||
{
|
||||
$session = getSessionElement(self::SESSION_NAME, $this->_filterUniqueId);
|
||||
|
||||
if (isset($session[$name]))
|
||||
if (!isError($session) && isset($session[$name]))
|
||||
{
|
||||
return $session[$name];
|
||||
}
|
||||
@@ -623,7 +621,7 @@ class FilterCmptLib
|
||||
|
||||
if (!$this->_ci->permissionlib->hasAtLeastOne($this->_requiredPermissions, self::PERMISSION_FILTER_METHOD, self::PERMISSION_TYPE))
|
||||
{
|
||||
$this->_setSession(error('The required permission is not help by the logged user'));
|
||||
$this->_setSession(error('The required permission is not held by the logged user'));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -904,7 +902,7 @@ class FilterCmptLib
|
||||
$filterCmptsSession = getSession(self::SESSION_NAME);
|
||||
|
||||
// If something is present in session
|
||||
if ($filterCmptsSession != null)
|
||||
if (!isError($filterCmptsSession) && $filterCmptsSession != null)
|
||||
{
|
||||
// Loops in the session for all the filter components
|
||||
foreach ($filterCmptsSession as $filterCmpt => $filterCmptData)
|
||||
@@ -951,9 +949,11 @@ class FilterCmptLib
|
||||
{
|
||||
$session = getSessionElement(self::SESSION_NAME, $this->_filterUniqueId);
|
||||
|
||||
$session[$name] = $value;
|
||||
|
||||
setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value
|
||||
if (!isError($session) && $session != null)
|
||||
{
|
||||
$session[$name] = $value;
|
||||
setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -965,7 +965,7 @@ class FilterCmptLib
|
||||
$filterCmptsSession = getSession(self::SESSION_NAME);
|
||||
|
||||
// If something is present in session
|
||||
if ($filterCmptsSession != null)
|
||||
if (!isError($filterCmptsSession) && $filterCmptsSession != null)
|
||||
{
|
||||
// Loops in the session for all the filter components
|
||||
foreach ($filterCmptsSession as $filterCmpt => $filterCmptData)
|
||||
@@ -1174,3 +1174,4 @@ class FilterCmptLib
|
||||
return $filterName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -328,6 +328,7 @@ export default {
|
||||
url: error.request.responseURL
|
||||
}];
|
||||
} else {
|
||||
if (error.response.data.errors == undefined) return [];
|
||||
return error.response.data.errors;
|
||||
}
|
||||
} else if (error.request) {
|
||||
@@ -346,6 +347,9 @@ export default {
|
||||
function popHandleableErrors(errorHandling, errors) {
|
||||
const result = {};
|
||||
const copy = [];
|
||||
|
||||
if (errors == undefined) return {};
|
||||
|
||||
while (errors.length)
|
||||
copy.push(errors.pop());
|
||||
for (var error of copy) {
|
||||
@@ -551,4 +555,4 @@ export default {
|
||||
|
||||
app.provide('$api', app.config.globalProperties.$api);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user