Esempio n. 1
0
 /**
  * Get the WebUser
  *
  * @param unknown_type $username
  * @return WebUser
  */
 public function getUser($username = null)
 {
     if ($username === null) {
         return new WebUser($this);
     }
     if (!($userAccount = Core::getUser() instanceof UserAccount ? Core::getUser() : UserAccount::getUserByUsername($username)) instanceof UserAccount) {
         return null;
     }
     $user = new WebUser($this);
     $user->setUserAccount($userAccount);
     $user->setName($userAccount->getUsername());
     $user->setIsGuest(false);
     $user->setRoles($userAccount->getRoles());
     return $user;
 }