Scalr\LogCollector\AuditLogger::handlerUserAuthLogin PHP Method

handlerUserAuthLogin() protected method

user.auth.login handler
protected handlerUserAuthLogin ( Scalr_Account_Use\Scalr_Account_User | User $user ) : array
$user Scalr_Account_Use\Scalr_Account_User | Scalr\Model\Entity\Account\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;
    }