Exemple #1
0
 public function test_rwx()
 {
     $uid = 2;
     $gid = 30;
     $o = new user($this->dbObj, $uid, $gid);
     $p = new permission($this->dbObj);
     $objId = $o->create(__METHOD__, "777");
     $this->assertTrue(is_numeric($objId));
     $record = $p->get($objId);
     $this->assertTrue(is_array($record));
     $this->assertTrue(isset($record['perms']));
     $this->assertEquals($o->get($objId), $p->get($objId));
     $this->assertTrue($o->canRead(__METHOD__));
     $this->assertTrue($o->canWrite(__METHOD__));
     $this->assertTrue($o->canExecute(__METHOD__));
 }
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage invalid permission bit
  */
 public function test_getInvalidPermissionBit()
 {
     permission::getPermissionBit("123", 4);
 }
 public function canExecute($object)
 {
     $data = $this->p->getObject($object);
     $theBit = permission::getPermissionBit($data['perms'], permission::USER);
     return permission::canExecute($theBit);
 }