예제 #1
0
 public function testGetRight()
 {
     jAclDbManager::addSubject('super.cms', 2, 'cms~rights.super.cms');
     jAclDbManager::addSubject('admin.access', 1, 'admin~rights.access');
     jAclDbManager::addRight(1, 'super.cms', 'LIST');
     jAclDbManager::addRight(1, 'super.cms', 'UPDATE');
     jAclDbManager::addRight(1, 'super.cms', 'DELETE', 154);
     $this->assertEqual(jAcl::getRight('super.cms'), array('LIST', 'UPDATE'));
     // droit généraux sur le sujet super.cms
     $this->assertEqual(jAcl::getRight('admin.access'), array());
     $this->assertEqual(jAcl::getRight('super.cms', 154), array('LIST', 'UPDATE', 'DELETE'));
     // droit sur une ressource
     $this->assertEqual(jAcl::getRight('super.cms', 122), array('LIST', 'UPDATE'));
     // ressource non repertoriée
     jAclDbManager::addRight(1, 'admin.access', 'TRUE');
     $this->assertEqual(jAcl::getRight('admin.access'), array('TRUE'));
 }
예제 #2
0
 public function testRemoveSubject2()
 {
     // remove a subject when rights exists on it
     jAclDbManager::removeSubject('super.cms');
     array_shift($this->subjects);
     $this->assertTableContainsRecords('jacl_subject', $this->subjects);
     $this->rights = array(array('id_aclsbj' => 'admin.access', 'id_aclgrp' => 1, 'id_aclres' => null, 'value' => 'TRUE'));
     $this->assertTableContainsRecords('jacl_rights', $this->rights);
 }