mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-18 16:18:47 +02:00
Profiles defined in XML: include subclasses (explicit declarations have precedence)
SVN:trunk[2150]
This commit is contained in:
@@ -1073,12 +1073,15 @@ EOF;
|
||||
if ($sType == 'stimulus')
|
||||
{
|
||||
$sGrantKey = $iProfile.'_'.$sClass.'_s_'.$sAction;
|
||||
$sGrantKeyPlus = $iProfile.'_'.$sClass.'+_s_'.$sAction; // subclasses inherit this grant
|
||||
}
|
||||
else
|
||||
{
|
||||
$sAction = $aActionsInShort[$sType];
|
||||
$sGrantKey = $iProfile.'_'.$sClass.'_'.$sAction;
|
||||
$sGrantKeyPlus = $iProfile.'_'.$sClass.'+_'.$sAction; // subclasses inherit this grant
|
||||
}
|
||||
// The class itself
|
||||
if (isset($aGrants[$sGrantKey]))
|
||||
{
|
||||
if (!$bGrant)
|
||||
@@ -1090,6 +1093,18 @@ EOF;
|
||||
{
|
||||
$aGrants[$sGrantKey] = $bGrant;
|
||||
}
|
||||
// The subclasses
|
||||
if (isset($aGrants[$sGrantKeyPlus]))
|
||||
{
|
||||
if (!$bGrant)
|
||||
{
|
||||
$aGrants[$sGrantKeyPlus] = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$aGrants[$sGrantKeyPlus] = $bGrant;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1124,6 +1139,14 @@ class ProfilesConfig
|
||||
{
|
||||
return self::\$aGRANTS[\$sGrantKey];
|
||||
}
|
||||
foreach (MetaModel::EnumParentClasses(\$sClass) as \$sParent)
|
||||
{
|
||||
\$sGrantKey = \$iProfileId.'_'.\$sParent.'+_'.\$sAction;
|
||||
if (isset(self::\$aGRANTS[\$sGrantKey]))
|
||||
{
|
||||
return self::\$aGRANTS[\$sGrantKey];
|
||||
}
|
||||
}
|
||||
\$sGrantKey = \$iProfileId.'_*_'.\$sAction;
|
||||
if (isset(self::\$aGRANTS[\$sGrantKey]))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user