Skip to content

Commit

Permalink
Merge pull request #11243 from BabovicT/patch-24
Browse files Browse the repository at this point in the history
FIX: forbidden conditions on search
  • Loading branch information
kingjia90 committed Jan 24, 2022
2 parents aed0120 + 445520d commit fbb2bad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bundles/AdminBundle/Controller/Searchadmin/SearchController.php
Expand Up @@ -355,9 +355,9 @@ protected function getForbiddenCondition($types = ['assets', 'documents', 'objec
$forbiddenConditions = [];

//exclude forbidden assets
if (in_array('asset', $types)) {
if (in_array('assets', $types)) {
if (!$user->isAllowed('assets')) {
$forbiddenConditions[] = " `type` != 'asset' ";
$forbiddenConditions[] = " maintype != 'asset' ";
} else {
$forbiddenAssetPaths = Element\Service::findForbiddenPaths('asset', $user);
if (count($forbiddenAssetPaths) > 0) {
Expand All @@ -370,9 +370,9 @@ protected function getForbiddenCondition($types = ['assets', 'documents', 'objec
}

//exclude forbidden documents
if (in_array('document', $types)) {
if (in_array('documents', $types)) {
if (!$user->isAllowed('documents')) {
$forbiddenConditions[] = " `type` != 'document' ";
$forbiddenConditions[] = " maintype != 'document' ";
} else {
$forbiddenDocumentPaths = Element\Service::findForbiddenPaths('document', $user);
if (count($forbiddenDocumentPaths) > 0) {
Expand All @@ -385,9 +385,9 @@ protected function getForbiddenCondition($types = ['assets', 'documents', 'objec
}

//exclude forbidden objects
if (in_array('object', $types)) {
if (in_array('objects', $types)) {
if (!$user->isAllowed('objects')) {
$forbiddenConditions[] = " `type` != 'object' ";
$forbiddenConditions[] = " maintype != 'object' ";
} else {
$forbiddenObjectPaths = Element\Service::findForbiddenPaths('object', $user);
if (count($forbiddenObjectPaths) > 0) {
Expand Down

0 comments on commit fbb2bad

Please sign in to comment.