Пример #1
0
 function testRevokeRoleFromUser()
 {
     $userId = 2;
     $objAuth2 = new ObjectAuthAssignment();
     $objAuth2->objectType = 'Election';
     $objAuth2->objectId = 2;
     $objAuth2->revokeRoleFromUser($userId, 'election_admin');
     $this->assertEquals(1, $this->commandGetAuthAssignment($userId, 'election_admin')->query()->count());
     $this->assertEquals(0, $this->commandGetObjectAssignment(2, 2)->query()->count());
     $this->assertEquals(1, $this->commandGetObjectAssignment(1, 2)->query()->count());
     $objAuth1 = new ObjectAuthAssignment();
     $objAuth1->objectType = 'Election';
     $objAuth1->objectId = 1;
     $objAuth1->revokeRoleFromUser($userId, 'election_admin');
     $this->assertEquals(1, $this->commandGetAuthAssignment($userId, 'election_admin')->query()->count());
     //we will not delete entry from AuthAssignment
     $this->assertEquals(0, $this->commandGetObjectAssignment(2, 2)->query()->count());
     $this->assertEquals(0, $this->commandGetObjectAssignment(1, 2)->query()->count());
 }
 public function getFetchAssignedWithAccessCommand($authItem, $traverse = true)
 {
     return $this->_oaa->getFetchAssignedWithAccessCommand($authItem, $traverse);
 }