mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-20 15:52:24 +02:00
Merge remote-tracking branch 'origin/support/3.0' into support/3.1
This commit is contained in:
@@ -446,6 +446,12 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
UR_ACTION_BULK_DELETE => 'bd',
|
UR_ACTION_BULK_DELETE => 'bd',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...]
|
||||||
|
* @since 2.7.10 3.0.4 3.1.1 3.2.0 N°6887
|
||||||
|
*/
|
||||||
|
private $aUsersProfilesList = [];
|
||||||
|
|
||||||
// Installation: create the very first user
|
// Installation: create the very first user
|
||||||
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
||||||
{
|
{
|
||||||
@@ -758,8 +764,12 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
$sAction = self::$m_aActionCodes[$iActionCode];
|
$sAction = self::$m_aActionCodes[$iActionCode];
|
||||||
|
|
||||||
$bStatus = null;
|
$bStatus = null;
|
||||||
|
// Cache user's profiles
|
||||||
|
if(false === array_key_exists($iUser, $this->aUsersProfilesList)){
|
||||||
|
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
|
||||||
|
}
|
||||||
// Call the API of UserRights because it caches the list for us
|
// Call the API of UserRights because it caches the list for us
|
||||||
foreach(UserRights::ListProfiles($oUser) as $iProfile => $oProfile)
|
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
|
||||||
{
|
{
|
||||||
$bGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction);
|
$bGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction);
|
||||||
if (!is_null($bGrant))
|
if (!is_null($bGrant))
|
||||||
@@ -885,11 +895,16 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
// Note: this code is VERY close to the code of IsActionAllowed()
|
// Note: this code is VERY close to the code of IsActionAllowed()
|
||||||
$iUser = $oUser->GetKey();
|
$iUser = $oUser->GetKey();
|
||||||
|
|
||||||
|
// Cache user's profiles
|
||||||
|
if(false === array_key_exists($iUser, $this->aUsersProfilesList)){
|
||||||
|
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
|
||||||
|
}
|
||||||
|
|
||||||
// Note: The object set is ignored because it was interesting to optimize for huge data sets
|
// Note: The object set is ignored because it was interesting to optimize for huge data sets
|
||||||
// and acceptable to consider only the root class of the object set
|
// and acceptable to consider only the root class of the object set
|
||||||
$bStatus = null;
|
$bStatus = null;
|
||||||
// Call the API of UserRights because it caches the list for us
|
// Call the API of UserRights because it caches the list for us
|
||||||
foreach(UserRights::ListProfiles($oUser) as $iProfile => $oProfile)
|
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
|
||||||
{
|
{
|
||||||
$bGrant = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode);
|
$bGrant = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode);
|
||||||
if (!is_null($bGrant))
|
if (!is_null($bGrant))
|
||||||
|
|||||||
Reference in New Issue
Block a user