public function testRemoveRight() { // let's cancel an existing right jAcl2DbManager::removeRight('group1', 'admin.access', '', true); $r = array(array('id_aclsbj' => 'super.cms.list', 'id_aclgrp' => 'group1', 'id_aclres' => null, 'canceled' => 0), array('id_aclsbj' => 'super.cms.list2', 'id_aclgrp' => 'group1', 'id_aclres' => null, 'canceled' => 0), array('id_aclsbj' => 'admin.access', 'id_aclgrp' => 'group1', 'id_aclres' => null, 'canceled' => 1)); $this->assertTableContainsRecords('jacl2_rights', $r); // let's remove an existing right jAcl2DbManager::removeRight('group1', 'admin.access'); array_pop($r); $this->assertTableContainsRecords('jacl2_rights', $r); $this->assertTrue(jAcl2DbManager::addRight('group1', 'admin.access')); }
public function testCheckCanceledRight() { $usergroups = array(array('login' => 'laurent', 'id_aclgrp' => 'group2')); $this->insertRecordsIntoTable('jacl2_user_group', array('login', 'id_aclgrp'), $usergroups); jAcl2::clearCache(); jAcl2DbUserGroup::clearCache(); // it should cancel the right super.cms.update (which is set on group1) jAcl2DbManager::removeRight('group2', 'super.cms.update', '', true); $this->assertTrue(jAcl2::check('super.cms.list')); $this->assertFalse(jAcl2::check('super.cms.update')); // is canceled $this->assertFalse(jAcl2::check('super.cms.create')); // doesn't exist $this->assertFalse(jAcl2::check('super.cms.read')); // doesn't exist $this->assertFalse(jAcl2::check('super.cms.delete')); // doesn't exist $this->assertTrue(jAcl2::check('admin.access')); $this->assertTrue(jAcl2::check('super.cms.list', 154)); // droit sur une ressource $this->assertFalse(jAcl2::check('super.cms.update', 154)); // droit sur une ressource $this->assertTrue(jAcl2::check('super.cms.delete', 154)); // droit sur une ressource $this->assertTrue(jAcl2::check('super.cms.list', 122)); // ressource non repertoriée $this->assertFalse(jAcl2::check('super.cms.update', 122)); // ressource non repertoriée $this->assertFalse(jAcl2::check('super.cms.delete', 122)); // ressource non repertoriée }