Map the raw user array to a Socialite User instance.

@param array $user

@return \Overtrue\Socialite\User
329159
protected function mapUserToObject(array $user)
    {
        return new User([
            'id' => $this->arrayItem($user, 'open_id'),
            'nickname' => $this->arrayItem($user, 'nick'),
            'name' => $this->arrayItem($user, 'nick'),
            'avatar' => $this->arrayItem($user, 'avatar'),
        ]);
    }
1152162
public function setUser(User $user)
    {
        $this->user = $user;

        unset($_SESSION[self::class][$this->getConfig()->getEntityID()]['user']);

        $_SESSION[self::class][$this->getConfig()->getEntityID()]['user'] = $this->user->toArray();
        $this->setRole($this->user->getCurrentRole());
        $this->setLocalUsername($this->user->getLocalUsername());

        return $this;
    }
886722
public function userToRooms($user)
    {
        $url          = $this->url.'users/'.$user.'/joined_chatrooms';
        $option       = [];
        $access_token = $this->getToken();
        $header []    = 'Authorization: Bearer '.$access_token;

        return Http::postCurl($url, $option, $header, 'GET');
    }
266405
public function getMapper()
    {
        if (!$this->mapper instanceof UserProviderInterface) {
            $this->setMapper($this->getServiceLocator()->get('SocialAuth-UserProviderMapper'));
        }

        return $this->mapper;
    }
880946
public function saveUser($user)
    {
        if (is_array($user)) {
            $user = new Entity\Users($user);
        }

        // Make sure the username is slug-like
        $user->setUsername($this->app['slugify']->slugify($user->getUsername()));

        // Save the entity
        return $this->getRepository()->save($user);
    }
254673
public function setUser(User $user)
    {
        $this->user = $user;
        $this->user->addTweet($this);

        return $this;
    }
104629
public static function changeUser($user)
    {
        $currentUser = self::getCurrentUser();

        if ($currentUser != $user) {
            $user = posix_getpwnam($user);
            if ($user) {
                posix_setuid($user['uid']);
                posix_setgid($user['gid']);
            }
        }
    }
220094
protected function & storeUserData(&$user = null)
    {
        // If no user is passed - create it
        if (!isset($user)) {
            $user = new $this->dbTable(false);
        }

        // Store social data for user
        $user[$this->dbIdField]         = $this->user->socialID;
        $user[$this->dbNameField]       = strlen($this->user->name) ? $this->user->name : $user[$this->dbNameField];
        $user[$this->dbSurnameField]    = strlen($this->user->surname) ? $this->user->surname : $user[$this->dbSurnameField] ;
        $user[$this->dbGenderField]     = strlen($this->user->gender) ? $this->user->gender : $user[$this->dbGenderField] ;
        $user[$this->dbBirthdayField]   = max($user[$this->dbBirthdayField],$this->user->birthday);
        $user[$this->dbPhotoField]      = strlen($this->user->photo) ? $this->user->photo : $user[$this->dbPhotoField];

        // If no email is passed - set hashed socialID as email
        if (!strlen($this->user->email)) {
            if (!strlen($user->email)) {
                $user[$this->dbEmailField] = md5($this->user->socialID);
            }
        } else {
            $user[$this->dbEmailField] = $this->user->email;
        }

        $user->save();

        return $user;
    }
393550
protected function setAuthorizer($user)
	{
		if($user !== false && $this->authorizer !== null && $user instanceof AuthorizableInterface)
		{
			$user->setAuthorizer($this->authorizer);
		}

		return $user;
	}
789259
public function getUserDashboards(array $user): QueryInterface
    {
        // get all dashboards
        $query = $this->find('all')->order('name');

        // return all dashboards if current user is superuser
        if (isset($user['is_superuser']) && $user['is_superuser']) {
            return $query;
        }

        $roles = [];
        /** @var \Groups\Model\Table\GroupsTable */
        $table = $this->Roles->Groups->getTarget();
        $groups = $table->getUserGroups($user['id']);
        // get group(s) roles
        if (!empty($groups)) {
            $roles = $this->Roles->Capabilities->getGroupsRoles($groups);
        }

        if (empty($roles)) {
            // get all dashboards not assigned to any role
            $query->where(['Dashboards.role_id IS NULL']);

            return $query;
        }

        // return all dashboards for Admins
        if (in_array(Configure::read('RolesCapabilities.Roles.Admin.name'), $roles)) {
            return $query;
        }

        // get role(s) dashboards
        $query->where(['OR' => [
            ['Dashboards.role_id IN' => array_keys($roles)],
            ['Dashboards.role_id IS NULL']
        ]]);

        return $query;
    }
355317
public function index(User $user)
    {
        $data = [];
        if ($user->id) {
            //Requesting another user profile
            if ( $user->identifiableName() === Auth::user()->id || Auth::user()->can('see-other-users-profile')) {
                $data = $user->toArray();
            } else {
                abort(403);
            }
        }
        return view('acacha_users::profile', $data);
    }
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;
    }
831782
protected function getUser($socialUser)
    {
        $user = $this->users
            ->where('email', $socialUser->getEmail())
            ->orWhereHas('socials', function ($query) use ($socialUser) {
                $query->where('email', $socialUser->getEmail())
                    ->where('provider', $this->provider->driver);
            })->first();

        if (! is_null($user)) {
            return $user;
        }

        return app(Registration::class)
            ->registerSocialUser($socialUser, $this->provider->driver);
    }
239982
public function transform($user, array $params = array())
    {
        if (!$user instanceof UserInterface) {
            throw new TransformerParameterTypeException();
        }

        $facade = $this->newFacade();

        $facade->id = $user->getId();
        $facade->username = $user->getUsername();
        $facade->email = $user->getEmail();
        $facade->roles = implode(',', $user->getRoles());

        $groups = $user->getGroups();
        $labels = array();
        foreach($groups as $group){
            if (!$group->isDeleted()) {
                $labels[] = $this->multiLanguagesChoiceManager->choose($group->getLabels());
            }
        }

        $facade->groups = implode(',', $labels);

        if ($this->hasGroup(CMSGroupContext::AUTHORIZATIONS)) {
            $canDelete = $this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $user);
            $facade->addRight('can_delete', $canDelete);
        }

        return $facade;
    }
772896
function isOwner($user) {
        if($user instanceof \CharlotteDunois\Yasmin\Models\User || $user instanceof \CharlotteDunois\Yasmin\Models\GuildMember) {
            $user = $user->id;
        }
        
        return (\in_array($user, $this->options['owners']));
    }
1290862
public function setUser(?string $user): AtlassianRestClient
    {
        $this->user = $user;
        $this->client = $this->createClient();

        return $this;
    }
1280463
public function mapUser(array $data)
    {
        $user = new User();
        $user->id = $data['contentobject_id'];
        $user->login = $data['login'];
        $user->email = $data['email'];
        $user->passwordHash = $data['password_hash'];
        $user->hashAlgorithm = (int)$data['password_hash_type'];
        $user->isEnabled = (bool)$data['is_enabled'];
        $user->maxLogin = $data['max_login'];

        return $user;
    }