예제 #1
0
 public function testAddResourceRight()
 {
     $this->assertTrue(jAclDbManager::addRight(1, 'super.cms', 'UPDATE', 154));
     $this->assertTrue(jAclDbManager::addRight(1, 'super.cms', 'UPDATE', 92));
     $this->rights[] = array('id_aclsbj' => 'super.cms', 'id_aclgrp' => 1, 'id_aclres' => '154', 'value' => 'UPDATE');
     $this->rights[] = array('id_aclsbj' => 'super.cms', 'id_aclgrp' => 1, 'id_aclres' => '92', 'value' => 'UPDATE');
     $this->assertTableContainsRecords('jacl_rights', $this->rights);
 }
예제 #2
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'));
 }