Profiles defined in XML: include subclasses (explicit declarations have precedence)

SVN:trunk[2150]
This commit is contained in:
Romain Quetiez
2012-08-20 13:25:11 +00:00
parent 38cca0c144
commit c01cdbb569

View File

@@ -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]))
{