get detailed user information

@param  string $user
@return array
@throws \GuzzleHttp\Exception\BadResponseException
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;
    }
536233
protected function getUser($id)
    {
        $class = Yii::$app->user->identityClass;
        if (!class_exists($class)) {
            return null;
        }
        $user = $class::find()->id($id)->one();
        if (empty($user) || !($user instanceof User)) {
            throw new BadRequestHttpException(Yii::t('user', 'User Not Found.'));
        }
        return $user;
    }
571405
public function fetchUser(User $user)
    {
        $response = $this->getResponse(
            sprintf('%s.json',
                $user->getUsername()
            )
        );

        return $this->hydrator->hydrate($user, $response);
    }
1319775
public function getRegistrationsSummaryForUser(User $user)
    {
        $data = [];
        $rsm = $this->createResultSetMappingBuilder('d');
        $rsm->addScalarResult('sbas_id','sbas_id');
        $rsm->addScalarResult('base_id','base_id');
        $rsm->addScalarResult('dbname','dbname');
        $rsm->addScalarResult('time_limited', 'time_limited');
        $rsm->addScalarResult('limited_from', 'limited_from');
        $rsm->addScalarResult('limited_to', 'limited_to');
        $rsm->addScalarResult('actif', 'actif');

        $sql = "
        SELECT dbname, sbas.sbas_id, time_limited,
               UNIX_TIMESTAMP( limited_from ) AS limited_from,
               UNIX_TIMESTAMP( limited_to ) AS limited_to,
               bas.server_coll_id, Users.id, basusr.actif,
               bas.base_id, " . $rsm->generateSelectClause(['d' => 'd',]) . "
        FROM (Users, bas, sbas)
          LEFT JOIN basusr ON ( Users.id = basusr.usr_id AND bas.base_id = basusr.base_id )
          LEFT JOIN Registrations d ON ( d.user_id = Users.id AND bas.base_id = d.base_id )
        WHERE basusr.actif = 1 AND bas.sbas_id = sbas.sbas_id
        AND Users.id = ?";

        $query = $this->_em->createNativeQuery($sql, $rsm);
        $query->setParameter(1, $user->getId());

        foreach ($query->getResult() as $row) {
            $registrationEntity = $row[0];
            $data[$row['sbas_id']][$row['base_id']] = [
                'base-id' => $row['base_id'],
                'db-name' => $row['dbname'],
                'active' => (Boolean) $row['actif'],
                'time-limited' => (Boolean) $row['time_limited'],
                'in-time' => $row['time_limited'] && ! ($row['limited_from'] >= time() && $row['limited_to'] <= time()),
                'registration' => $registrationEntity
            ];
        }

        return $data;
    }
534340
private function listUserAuthorizedCollections(User $user)
    {
        $acl = $this->getAclForUser($user);
        $rights = $acl->get_bas_rights();
        $bases = $acl->get_granted_base();

        $grants = [];

        $statusMapper = new RestrictedStatusExtractor($acl, $this->getApplicationBox());

        foreach ($bases as $base) {
            $baseGrants = [];

            foreach ($rights as $right) {
                if (!$acl->has_right_on_base($base->get_base_id(), $right)) {
                    continue;
                }

                $baseGrants[] = $right;
            }

            $grants[] = [
                'databox_id'    => $base->get_sbas_id(),
                'base_id'       => $base->get_base_id(),
                'collection_id' => $base->get_coll_id(),
                'name'          => $base->get_name(),
                'logo'          => $base->get_binary_minilogos() ? base64_encode($base->get_binary_minilogos()) : '',
                'labels'        => [
                    'fr' => $base->get_label('fr'),
                    'en' => $base->get_label('en'),
                    'de' => $base->get_label('de'),
                    'nl' => $base->get_label('nl'),
                ],
                'rights'        => $baseGrants,
                'statuses'      => $statusMapper->getRestrictedStatuses($base->get_base_id())
            ];
        }

        return $grants;
    }
666253
public function getAllUnread(User $user = null)
    {
        // If there's no passed user, get the current logged in user
        $user = $user ?? Craft::$app->getUser();

        if ($user) {
            $notifications = NotificationsRecord::find()->where(['notifiable' => $user->id, 'read_at' => null])->all();
            return $this->formatNotificationData($notifications)->toArray();
        }

        // No notifications when we don't have a passed in or logged in user
        return [];
    }
51862
protected function fillUserDetails($user)
    {
         $mappings = Config::get('laravel-saml::saml.object_mappings',[]);
         foreach($mappings as $key => $mapping)
         {
             $user->{$key} = $this->getSamlAttribute($mapping);
         }
    }
878843
public static function user($user = null)
    {
        if ($user !== null) {
            self::$_user = $user;
        }
        if (!self::$_user) {
            return null;
        }
        return self::$_user;
    }
70760
public function getUser($user) {
            if ($user instanceof TokenInterface) {
                $id = $user->getService();
            } else if (is_array($user)) {
                $id = $user['service'];
            } else {
                $id = $user;
            }

            if (!isset($this->users[$id])) {
                // TODO: execption
                return null;
            }
            if (is_string($this->users[$id])) {
                $this->users[$id] = $this->container->get($this->users[$id]);
            }

            if ($user instanceof TokenInterface) {
                $this->users[$id]->setTokenData($user);
            } else if (is_array($user)) {
                $this->users[$id]->setOptions($user);
            }

            return $this->users[$id];
        }
1181112
public function indexAction(User $user = null)
    {
        return [
            'isAdmin' => !is_null($user) ? $user->hasRole('ROLE_ADMIN') : false,
            'resourceTypes' => array_map(function (ResourceType $type) {
                return $this->resourceTypeSerializer->serialize($type);
            }, $this->resourceTypeRepo->findBy([], ['name' => 'ASC'])),
        ];
    }
585232
private function byRequestRememberPasswordSpecification($user)
    {
        (new RequestRememberPasswordCommandBuilder($this->container, $this->persistence))->build($user);

        return [
            'command' => ByRequestRememberPasswordChangeUserPasswordCommand::class,
            'handler' => ByRequestRememberPasswordChangeUserPasswordHandler::class,
        ];
    }
732972
public static function getNonBlameds($user = null)
    {
        $noInit = static::buildNoInitModel();
        /* @var $noInit static */
        $createdByAttribute = $noInit->createdByAttribute;
        if (!$user) {
            $user = \Yii::$app->user->identity;
        }
        $cond = [
            $createdByAttribute => $user->getGUID(),
            $noInit->multiBlamesAttribute => ''
        ];
        return static::find()->where($cond)->all();
    }
644680
function getAbsDir($user)
    {
        if (!$this->users[$user]['chroot'])
        {
            $rdir = $this->users[$user]['pwd'];
        }
        else
        {
            $rdir = $this->users[$user]['home'].$this->users[$user]['pwd'];
        }
        return $rdir;
    }
144381
public function getContexts($user)
    {
        $em = $this->getEntityManager();

        $contexts_rep = $em->getRepository('ACSACSPanelBundle:PanelSetting');
        $query = $contexts_rep->createQueryBuilder('ps')
            ->select('ps.context')
            ->where('ps.user = ?1')
            ->andWhere('ps.context NOT LIKE ?2')
            ->andWhere('ps.context NOT LIKE ?3')
            ->andWhere('ps.context NOT LIKE ?4')
            ->groupBy('ps.context')
            ->orderBy('ps.context')
            ->setParameter('1', $user)
            ->setParameter('2', 'internal')
            ->setParameter('3', 'user_internal')
            ->setParameter('4', 'system_internal')
            ->getQuery()
        ;

        $contexts = $query->execute();

        return $contexts;
    }
20388
protected function getVosForRegistration($user)
    {
        $vos = array();
        $members = array();
        $vosIdForRegistration = array();
        $vosForRegistration = array();

        $vos = $this->getVosByFacilityVoShortNames();
        foreach ($vos as $vo) {
            Logger::debug("Vo:" . print_r($vo, true));
            try {
                $member = $this->rpcAdapter->getMemberByUser($user, $vo);
                Logger::debug("Member:" . print_r($member, true));
                array_push($members, $member);
            } catch (\Exception $exception) {
                array_push($vosForRegistration, $vo);
                Logger::warning("perun:PerunIdentity: " . $exception);
            }
        }

        foreach ($members as $member) {
            if ($member->getStatus() === Member::VALID ||
                $member->getStatus() === Member::EXPIRED) {
                array_push($vosIdForRegistration, $member->getVoId());
            }
        }

        foreach ($vos as $vo) {
            if (in_array($vo->getId(), $vosIdForRegistration)) {
                array_push($vosForRegistration, $vo);
            }
        }
        Logger::debug("VOs for registration:  " . print_r($vosForRegistration, true));
        return $vosForRegistration;
    }
655277
protected function getUserName(User $user): string
    {
        $contentInfo = $this->repository->sudo(
            function (Repository $repository) use ($user): ContentInfo {
                return $this->loadService->loadContent($user->id)->contentInfo;
            }
        );

        return $contentInfo->name;
    }
370395
protected static function getUserGroups(array $user): array
    {
        $table = TableRegistry::get('Groups.Groups');
        Assert::isInstanceOf($table, GroupsTable::class);

        return $table->getUserGroups($user['id'], [
            'fields' => ['id'],
            'contain' => [],
        ]);
    }