Ejemplo n.º 1
0
 /**
  * 
  * Verifies access data and saves current user if successful
  * @param data Array containing 'Name' and 'Password' as keys with values
  * @param $dontSave If true, user is not saved in session (logged in)
  * @return bool
  */
 function Verify($data, $dontSave = false)
 {
     if (!isset($data['Password']) || !isset($data['Name'])) {
         return false;
     }
     $name = $data['Name'];
     $user = User::Schema()->ByName($name);
     if ($user) {
         $password = $data['Password'];
         $pwHash = hash('sha256', $password . $user->GetPasswordSalt());
         if ($pwHash == $user->GetPassword()) {
             if (!$dontSave) {
                 $this->user = $user;
                 $_SESSION[self::$sessionParam] = $this->user->GetID();
             }
             return true;
         }
     }
     return false;
 }
 private function UserGroupWhere(Usergroup $group)
 {
     $sql = Access::SqlBuilder();
     $tblUug = UserUsergroup::Schema()->Table();
     return $sql->Equals($tblUug->Field('User'), $sql->Value($this->user->GetID()))->And_($sql->Equals($tblUug->Field('UserGroup'), $sql->Value($group->GetID())));
 }
Ejemplo n.º 3
0
 /**
  * The url to the form for the user groups
  * @param User $user
  * @return string
  */
 protected function GroupsFormUrl(User $user)
 {
     $args = array('user' => $user->GetID());
     return BackendRouter::ModuleUrl(new UsergroupAssignmentForm(), $args);
 }