mirror of
https://github.com/Combodo/iTop.git
synced 2026-07-14 10:46:39 +02:00
N°9723 - IsActionAllowed should work with non instantiated users objects (#947)
* Replace references to user objects keys since objects can be non-instantiated (so no key available) and replace them by equivalent code * Rename test + use self variable for profile --------- Co-authored-by: jf-cbd <jf-cbd@users.noreply.github.com>
This commit is contained in:
@@ -81,6 +81,17 @@ class UserRightsTest extends ItopDataTestCase
|
||||
return $oUser;
|
||||
}
|
||||
|
||||
public function testIsActionAllowedWithNonInstantiatedUserObject()
|
||||
{
|
||||
$oUser = $this->GivenUserWithProfiles('test1', [self::$aURP_Profiles['Configuration Manager']]); // not a readonly profile
|
||||
$oAdminUser = $this->GivenUserWithProfiles('test2', [self::$aURP_Profiles['Administrator']]);
|
||||
$oAdminUser->DBInsert();
|
||||
$_SESSION = [];
|
||||
UserRights::Login($oAdminUser->Get('login'));
|
||||
|
||||
self::assertTrue(UserRights::IsActionAllowed('Server', UR_ACTION_MODIFY, null, $oUser) === UR_ALLOWED_YES);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aProfileIds
|
||||
* @param array $aShouldBeAllowedToSeeClass
|
||||
|
||||
Reference in New Issue
Block a user