auth: Check the businessprocess/showall permission prior any restrictions

fixes #200
This commit is contained in:
Johannes Meyer 2019-02-18 13:43:06 +01:00
parent a1df0347f5
commit 56e37d2876
2 changed files with 9 additions and 4 deletions

View file

@ -137,6 +137,10 @@ class Metadata
}
}
if ($auth->hasPermission('businessprocess/showall')) {
return true;
}
$prefixes = $auth->getRestrictions('businessprocess/prefix');
if (! empty($prefixes)) {
if (! $this->nameIsPrefixedWithOneOf($prefixes)) {
@ -144,10 +148,6 @@ class Metadata
}
}
if ($auth->hasPermission('businessprocess/showall')) {
return true;
}
if (! $this->hasRestrictions()) {
return true;
}

View file

@ -38,6 +38,11 @@ abstract class BpConfigBaseForm extends QuickForm
$meta = $config->getMetadata();
$auth = Auth::getInstance();
$meta->set('Owner', $auth->getUser()->getUsername());
if ($auth->hasPermission('businessprocess/showall')) {
return true;
}
$prefixes = $auth->getRestrictions('businessprocess/prefix');
if (! empty($prefixes) && ! $meta->nameIsPrefixedWithOneOf($prefixes)) {
if (count($prefixes) === 1) {