Beispiel #1
0
    /**
     * Get's all Role-Assignments for a certain user.
     * If no user is set, all role assignments are returned.
     *
     * @param StudIPUser $user
     * @return array with roleids and the assigned userids
     */
    public static function getAllRoleAssignments($user=null)
    {
        if ($user == null)
        {
            $result = DBManager::get()->query("SELECT * FROM roles_user");
        }
        else
        {
            $result = DBManager::get()->prepare("SELECT * FROM roles_user WHERE userid=?");
            $result->execute(array($user->getUserid()));
        }

        $roles_user = array();
        while (!$result->EOF)
        {
            $roles_user[$row["roleid"]] = $row["userid"];
        }
        return $roles_user;
    }
Beispiel #2
0
 /**
  * checks, if this user is identical to the otheruser
  *
  * @param StudIPUser $otheruser
  * @return boolean same user or not
  */
 public function isSameUser(StudIPUser $otheruser)
 {
     return $otheruser->getUserid() === $this->getUserid();
 }