getTeams() публичный Метод

Gets user teams
public getTeams ( ) : array
Результат array
Пример #1
0
 /**
  * user.auth.login handler
  *
  * @param Scalr_Account_User|Entity\Account\User  $user  User object
  * @return array   Returns array of the fields to log
  */
 protected function handlerUserAuthLogin($user)
 {
     if ($user instanceof Scalr_Account_User || $user instanceof Entity\Account\User) {
         $this->user = $user;
         $teams = [];
         // Teams are needed for the audit log
         foreach ($user->getTeams() as $rec) {
             $teams[$rec['id']] = $rec['name'];
         }
         $lastVisit = $user->dtLastLogin ?: $user->dtCreated;
         $data = ['.result' => 'success', '.teams' => $teams, '.last_login' => $lastVisit ? static::getTimestamp(strtotime($lastVisit)) : null, '.user_type' => $user->type];
     }
     return isset($data) ? $data : $user;
 }
Пример #2
0
 /**
  * user.auth.login handler
  *
  * @param  Entity\Account\User|Scalr_Account_User|array $user User object
  * @param  int     $envId Identifier of the Environment
  * @param  string  $ip    Remote Addres of the User
  * @param  int     $ruid  Real user identifier
  * @return array   Returns array of the fields to log
  */
 private function handlerUserAuthLogin($user, $envId = null, $ip = null, $ruid = null)
 {
     if ($user instanceof Scalr_Account_User || $user instanceof Entity\Account\User) {
         $this->user = $user;
         $this->envId = $envId;
         $this->ipAddress = $ip;
         $this->realUserId = $ruid;
         // Teams are needed for the audit log
         $teams = [];
         foreach ($user->getTeams() as $rec) {
             $teams[$rec['id']] = $rec['name'];
         }
         $lastVisit = $user->dtLastLogin ?: $user->dtCreated;
         $data = ['result' => 'success', 'teams' => $teams, 'last_login' => $lastVisit ? static::getTimestamp(strtotime($lastVisit)) : null, 'user_type' => $user->type];
     }
     return isset($data) ? $data : $user;
 }