예제 #1
0
 public function testAddSubject()
 {
     jAclDbManager::addSubject('super.cms', 2, 'cms~rights.super.cms');
     $this->subjects = array(array('id_aclsbj' => 'super.cms', 'id_aclvalgrp' => 2, 'label_key' => 'cms~rights.super.cms'));
     $this->assertTableContainsRecords('jacl_subject', $this->subjects);
     jAclDbManager::addSubject('jxacl.groups.management', 3, 'jxacl~db.sbj.groups.management');
     jAclDbManager::addSubject('admin.access', 1, 'admin~rights.access');
     jAclDbManager::addSubject('admin.foo', 1, 'admin~rights.foo');
     $this->subjects[] = array('id_aclsbj' => 'jxacl.groups.management', 'id_aclvalgrp' => 3, 'label_key' => 'jxacl~db.sbj.groups.management');
     $this->subjects[] = array('id_aclsbj' => 'admin.access', 'id_aclvalgrp' => 1, 'label_key' => 'admin~rights.access');
     $this->subjects[] = array('id_aclsbj' => 'admin.foo', 'id_aclvalgrp' => 1, 'label_key' => 'admin~rights.foo');
     $this->assertTableContainsRecords('jacl_subject', $this->subjects);
 }
예제 #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'));
 }