{@inheritdoc}

@see \Concrete\Core\Attribute\Category\CategoryInterface::getAttributeValues()

@param \Concrete\Core\Entity\User\User $user

@return \Concrete\Core\Entity\Attribute\Value\UserValue[]
494797
public function getAttributeValues($user)
    {
        $r = $this->entityManager->getRepository('\Concrete\Core\Entity\Attribute\Value\UserValue');
        $values = $r->findBy([
            'user' => $user,
        ]);

        return $values;
    }
853395
public function findUserList(User $user)
    {
        $dql = 'SELECT e FROM Phraseanet:UsrListEntry e
            WHERE e.user = :usr_id';

        $params = [
            'usr_id' => $user->getId(),
        ];

        $query = $this->_em->createQuery($dql);
        $query->setParameters($params);

        return $query->getResult();
    }
889536
public static function userAssignments($user)
    {
        $names = self::find()->where(['user_id' => $user->id])->select('item_name')->column();
        return AuthItem::find()->where(['in', 'name', $names]);
    }
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;
    }
343565
public function normalize(
        UserAttribute $userAttribute,
        UserAttributeValue $userAttributeValue = null
    ) {
        // original value
        if ($userAttributeValue) {
            $originalAttributeValue = $userAttributeValue->getValue();
        } else {
            $originalAttributeValue = null;
        }

        // prepare value
        $value = [];

        // value for view
        $value['view'] = $originalAttributeValue;
        if ($originalAttributeValue) {

            // translate value
            if ($userAttribute->isTranslateable()) {
                $value['view'] = $this->translator->trans($value['view']);
            }

            // format value
            $printFormat = $userAttribute->getPrintFormat();
            if ($printFormat) {
                $value['view'] = $this->renderValue(
                    $printFormat,
                    [
                        'value' => $value['view'],
                    ]
                );
            }
        }

        // value for edit
        $value['edit'] = $originalAttributeValue;

        // common attribute keys
        $normalizedAttributes = [
            'name' => $userAttribute->getName(),
            'label' => $this->translator->trans($userAttribute->getName()),
            'description' => $this->translator->trans($userAttribute->getDescription()),
            'type' => $userAttribute->getType(),
            'value' => $value,
        ];

        return $normalizedAttributes;
    }
812523
protected function assignUserToUserGroups(User $user, array $userGroupObjects)
    {
        $ezUserGroups = [];
        foreach ($userGroupObjects as $userGroup) {
            $userGroup = $this->userGroupManager->createOrUpdate($userGroup);
            if ($userGroup instanceof UserGroupObject) {
                $ezUserGroup = $this->userGroupManager->find($userGroup);
                if ($ezUserGroup) {
                    $ezUserGroups[$ezUserGroup->id] = $ezUserGroup;
                    try {
                        $this->userService->assignUserToUserGroup($user, $ezUserGroup);
                    } catch (InvalidArgumentException $alreadyAssignedException) {
                        // Ignore error about: user already assigned to usergroup.
                    }
                }
            }
        }

        return $ezUserGroups;
    }
674915
public function getUserAttribute()
    {
        if($this->createdByUserID) {

            // search in cache
            $user = User::where('userID', $this->createdByUserID)->first();

            // search in database
            if (!$user) {
                $user = $this->getRelationValue('user');
            }
            return $user;
        }
        return null;
    }
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;
    }
1208552
public function getValues(array $attribute_names = [])
    {
        $values = [];
        if (!empty($attribute_names)) {
            foreach ($attribute_names as $attribute_name) {
                $values[$attribute_name] = $this->getValue($attribute_name);
            }
        } else {
            foreach ($this->getType()->getAttributes() as $attribute) {
                $values[$attribute->getName()] = $this->getValue($attribute->getName());
            }
        }

        return $values;
    }
455805
private function createAttributesQuery(User $user)
    {
        $query = $this->getEntityManager()
            ->createQuery('
                SELECT ua
                FROM UserBundle:UserAttribute ua
                LEFT JOIN ua.groups ug
                INDEX BY ua.id
                WHERE ug.id IN (:groupIds)
            ')
        ->setParameters([
            ':groupIds' => $user->getGroupIds(),
        ]);

        return $query;
    }
1112608
public function getValues()
    {
        $values = array();
        /** @var Input $input */
        foreach ($this->_inputs as $name => $input) {
            if (strlen($name) > 0) {
                $values[$name] = call_user_func_array(
                    [$input, 'getValue'],
                    [$name]
                );
            }
        }
        return $values;
    }
978275
public function getDefaultOwnerAttributeValue()
    {
        if (Yii::$app->has('user')) {
            $userId = Yii::$app->get('user')->id;
            if ($userId === null) { // something wrong
                throw new InvalidValueException('Empty owner ID');
            }
            return $userId;
        }
    }
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;
    }
851114
public function roles(User $user)
    {
        if ($this->session->hasValue(Roles::SESSION_KEY)) {
            return $this->session->value(Roles::SESSION_KEY);
        }

        $roles = $this->authorizationProvider->roles($user);
        $this->session->putValue(Roles::SESSION_KEY, $roles);
        return $roles;
    }
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;
    }
277682
public function transform($user)
    {
        $user = $this->entityToArray(User::class, $user);
        return [
            'id'        => (int) $user['id'],
            'email'     => $user['email'],
            'nick'      => $user['nick'],
            'firstName' => $user['first_name'],
            'lastName'  => $user['last_name'],
            'roles'     => !empty($user['roles']) ? $user['roles'] : []
        ];
    }
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'])),
        ];
    }