public function testGetRoleActionTargets() { $r = Role::getOneFromDb(['role_id' => 3], $this->DB); $ats = $r->getRoleActionTargets(); $this->assertEqual(9, count($ats)); $this->assertEqual(207, $ats[0]->role_action_target_link_id); $this->assertEqual(210, $ats[1]->role_action_target_link_id); $this->assertEqual(212, $ats[2]->role_action_target_link_id); $this->assertEqual(220, $ats[3]->role_action_target_link_id); $this->assertEqual(221, $ats[4]->role_action_target_link_id); $this->assertEqual(37, $ats[5]->role_action_target_link_id); $this->assertEqual(38, $ats[6]->role_action_target_link_id); $this->assertEqual(39, $ats[7]->role_action_target_link_id); $this->assertEqual(40, $ats[8]->role_action_target_link_id); }
public function loadRole() { $this->role = Role::getOneFromDb(['role_id' => $this->role_id, 'flag_delete' => FALSE], $this->dbConnection); }
public function getRoles() { $user_roles = array(); $user_roles = User_Role::getAllFromDb(['user_id' => $this->user_id], $this->dbConnection); if (count($user_roles) <= 0) { return array(Role::getOneFromDb(['name' => 'public'], $this->dbConnection)); } // $roles = Role::getAllFromDb(['role_id'=>array_map(function($e){return $e->role_id;},$user_roles)], $roles = Role::getAllFromDb(['role_id' => Db_Linked::arrayOfAttrValues($user_roles, 'role_id')], $this->dbConnection); return $roles; }
public function getRole() { return Role::getOneFromDb(['role_id' => $this->role_id, 'flag_delete' => FALSE], $this->dbConnection); }