Verified Commit 1155890a authored by Cyril Vazquez's avatar Cyril Vazquez
Browse files

FIX menu medona appearing when auth privilege uses wildcard and requirements are blacklisted

parent f7702b0b
Pipeline #6936 failed with stages
......@@ -24,6 +24,8 @@ class dashboard
public $userPrivileges = array();
public $blacklistUserStories;
/**
* Constructor of dashboard
* @param array $menu Menu of the dashboard
......@@ -53,6 +55,12 @@ class dashboard
$this->storage->currentOrganization = $currentOrganization;
}
if (isset(\laabs::configuration('auth')['blacklistUserStories'])) {
$this->blacklistUserStories = \laabs::configuration('auth')['blacklistUserStories'];
} else {
$this->blacklistUserStories = null;
}
$this->storage->menu = $this->filterMenuAuth($menu);
$this->storage->logo = $logo;
......@@ -140,6 +148,15 @@ class dashboard
{
// At least one requirement must be fulfilled
foreach ($requirement as $requirementItem) {
// Check privilege exists (avoid blacklisted)
if (is_array($this->blacklistUserStories)) {
foreach ($this->blacklistUserStories as $blacklistUserStory) {
if (fnmatch($blacklistUserStory, $requirementItem)) {
continue 2;
}
}
}
if (substr($requirementItem, -2) == '/*') {
foreach ($this->userPrivileges as $userPrivilege) {
$domain = explode('/', $userPrivilege)[0].'/?';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment