根据用户对象登录用户

@param User $user
@return array
501909
public function loginByRecord(User $user)
    {
        $this->loadRecordData($user);
        $this->session['user'] = $user->toArray($this->sessionFields);
        wei()->event->trigger('userLogin', [$user]);

        return ['code' => 1, 'message' => '登录成功'];
    }
526881
public function getUser($user)
    {
        $result = null;
        if ($user === 'current') {
            $u = new \User();
            if ($u->isRegistered()) {
                $result = $u;
            }
        } elseif (is_int($user) || (is_string($user) && is_numeric($user))) {
            $result = \User::getByUserID($user);
        } elseif ($user instanceof UserService) {
            $result = $user;
        } elseif ($user instanceof UserEntity) {
            $result = \User::getByUserID($user->getUserID());
        }

        return $result;
    }
117271
public function bindUser(User $user, $binding)
    {
        return $this->bindUserID(intval($user->getUserID(), 10), $binding);
    }
1101158
public function deleteUser(User $user)
    {
        $returnValue = $this->service->deleteUser($user);
        $this->signalDispatcher->emit(
            new DeleteUserSignal(
                array(
                    'userId' => $user->id,
                    'affectedLocationIds' => $returnValue,
                )
            )
        );

        return $returnValue;
    }
1033727
public function getChildren(User $user)
    {
        $returnArray = array();
        foreach ($this->userList as $u) {
            /** @var $u User */
            if ($u->getParent() == $user->getUsername()) {
                $returnArray[] = $u;
                $returnArray = array_merge($returnArray, $this->getChildren($u));
            }
        }
        return $returnArray;
    }
29951
public function UserCache($User) {
      $UserID = GetValue('UserID', $User, NULL);
      if (is_null($UserID) || !$UserID) return FALSE;
      
      $Cached = TRUE;
      
      $UserKey = FormatString(self::USERID_KEY, array('UserID' => $UserID));
      $Cached = $Cached & Gdn::Cache()->Store($UserKey, $User, array(
         Gdn_Cache::FEATURE_EXPIRY  => 3600
      ));
      
      $UserNameKey = FormatString(self::USERNAME_KEY, array('Name' => md5(GetValue('Name', $User))));
      $Cached = $Cached & Gdn::Cache()->Store($UserNameKey, $UserID, array(
         Gdn_Cache::FEATURE_EXPIRY  => 3600
      ));
      return $Cached;
   }
490137
public function serializeToString(User $user)
    {
        $serializedUser = $this->serialize($user);

        foreach ($serializedUser as $key => $value) {
            $serializedUser[$key] = base64_encode($value);
        }

        return base64_encode(json_encode($serializedUser));
    }
761122
private function serializeRestrictions(User $user)
    {
        return [
            'disabled' => !$user->isEnabled(),
            'removed' => $user->isRemoved(),
            'dates' => DateRangeNormalizer::normalize($user->getInitDate(), $user->getExpirationDate()),
        ];
    }
427745
public function getUser($user)
    {
        $params = [
            'name' => $user,
        ];

        $body = $this->request(self::URI_AUTH_USER_GET, $params);
        if ($this->pretty && isset($body['roles'])) {
            return $body['roles'];
        }

        return $body;
    }
1059243
public function getContactsUser(User $user)
    {
        return array_map(function (Contact $contact) {
            return $contact->getContact();
        }, $this->contactRepo->findBy(['user' => $user]));
    }
914801
public function user($user = null)
    {
        if ($user !== null) {
            $this->user = $user;
        }

        return $this->user;
    }
56144
private function fetchFromCache(User $user)
    {
        return $this->hasCache($user) ? self::$cache[$user->getId()] : null;
    }
1260849
public static function Attributes($user) {
      $user = (array)$user;
      $attributes = $user['Attributes'];
      if (is_string($attributes))
         $attributes = unserialize($attributes);
      if (!is_array($attributes))
         $attributes = array();
      return $attributes;
   }
775616
protected function getAllRoles(User $user)
    {
        $roles = [
            'Neos.Flow:Everybody' => $this->policyService->getRole('Neos.Flow:Everybody'),
            'Neos.Flow:AuthenticatedUser' => $this->policyService->getRole('Neos.Flow:AuthenticatedUser')
        ];

        /** @var Account $account */
        foreach ($user->getAccounts() as $account) {
            $accountRoles = $account->getRoles();
            /** @var $currentRole Role */
            foreach ($accountRoles as $currentRole) {
                if (!in_array($currentRole, $roles)) {
                    $roles[$currentRole->getIdentifier()] = $currentRole;
                }
                /** @var $currentParentRole Role */
                foreach ($currentRole->getAllParentRoles() as $currentParentRole) {
                    if (!in_array($currentParentRole, $roles)) {
                        $roles[$currentParentRole->getIdentifier()] = $currentParentRole;
                    }
                }
            }
        }

        return $roles;
    }
449998
public function getCoins(UserInterface $user)
    {
        $class = $this->getGameOptions()->getEntityAccountClass();
        $accEntityManager = $this->getAccountEntityManager();

        /** @var \GameBackend\Entity\Metin\Account\Repository\Account $repoAccount */
        $repoAccount = $accEntityManager->getRepository($class);
        $metinUser = $repoAccount->getUser($user);

        $result = 0;
        if ($metinUser) {
            $result = $metinUser->getCash();
        }

        return $result;
    }
1173382
public function persistUser(User $user)
    {
        $this->objectManager->persist($user);
        $this->objectManager->flush();

        return $user;
    }
1194547
public function getAssignments(User $user)
    {
        $assignments = array();
        foreach ($this->getAssignmentFactories($user) as $factory) {
            $assignments[] = $factory->toAssignment();
        }
        
        return $this->orderAssignments($assignments);
    }