@param ApiUser $apiUser

@return string[]
778441
private function getLoginParams( ApiUser $apiUser ) {
		$params = [
			'lgname' => $apiUser->getUsername(),
			'lgpassword' => $apiUser->getPassword(),
		];

		if ( !is_null( $apiUser->getDomain() ) ) {
			$params['lgdomain'] = $apiUser->getDomain();
		}
		return $params;
	}
1173831
public function serialize($user, array $options = [])
    {
        if (isset($options['public']) && $options['public']) {
            // TODO : remove me (only used by BBBPlugin and it's not maintained)
            return $this->serializePublic($user);
        }

        $serializedUser = [
            'autoId' => $user->getId(), //for old compatibility purposes
            'id' => $user->getUuid(),
            'name' => $user->getFirstName().' '.$user->getLastName(),
            'firstName' => $user->getFirstName(),
            'lastName' => $user->getLastName(),
            'username' => $user->getUsername(),
            'picture' => $this->serializePicture($user),
            'email' => $user->getEmail(),
            'administrativeCode' => $user->getAdministrativeCode(),
            'phone' => $user->getPhone(),
            'meta' => $this->serializeMeta($user),
            'publicUrl' => $user->getPublicUrl(), // todo : merge with the one from meta (I do it to have it in minimal)
            'permissions' => $this->serializePermissions($user),
            'restrictions' => $this->serializeRestrictions($user),
        ];

        if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
            $userRoles = array_map(function (Role $role) { // todo use role serializer with minimal option
                return [
                    'id' => $role->getUuid(),
                    'type' => $role->getType(),
                    'name' => $role->getName(),
                    'translationKey' => $role->getTranslationKey(),
                    'workspace' => $role->getWorkspace() ? ['id' => $role->getWorkspace()->getUuid()] : null,
                    'context' => 'user',
                ];
            }, $user->getEntityRoles(false));
            $groupRoles = array_map(function (Role $role) { // todo use role serializer with minimal option
                return [
                    'id' => $role->getUuid(),
                    'type' => $role->getType(),
                    'name' => $role->getName(),
                    'translationKey' => $role->getTranslationKey(),
                    'workspace' => $role->getWorkspace() ? ['id' => $role->getWorkspace()->getUuid()] : null,
                    'context' => 'group',
                ];
            }, $user->getGroupRoles());

            $serializedUser = array_merge($serializedUser, [
                'meta' => $this->serializeMeta($user),
                'restrictions' => $this->serializeRestrictions($user),
                'roles' => array_merge($userRoles, $groupRoles),
                'groups' => array_map(function (Group $group) { // todo use group serializer with minimal option
                    return [
                        'id' => $group->getUuid(),
                        'name' => $group->getName(),
                    ];
                }, $user->getGroups()->toArray()),
            ]);

            if ($user->getMainOrganization()) {
                $serializedUser['mainOrganization'] = $this->organizationSerializer->serialize($user->getMainOrganization());
            }

            $serializedUser['administratedOrganizations'] = array_map(function ($organization) {
                return $this->organizationSerializer->serialize($organization);
            }, $user->getAdministratedOrganizations()->toArray());
        }

        if (in_array(Options::SERIALIZE_FACET, $options)) {
            $fields = $this->om
                ->getRepository('Claroline\CoreBundle\Entity\Facet\FieldFacetValue')
                ->findPlatformValuesByUser($user);
            $serializedUser['facets'] = [];

            /** @var FieldFacetValue $field */
            foreach ($fields as $field) {
                // we just flatten field facets in the base user structure
                $serializedUser['profile'][$field->getFieldFacet()->getUuid()] = $field->getValue();
            }
        }

        return $this->decorate($user, $serializedUser);
    }
309396
protected function handlerArguments($user)
    {
        return [
            $this->container->getDefinition(
                'bengor.user.infrastructure.persistence.' . $user . '_repository'
            ),
            $this->container->getDefinition(
                'bengor.user.infrastructure.security.symfony.' . $user . '_password_encoder'
            ),
        ];
    }
1113739
public function validate($apiUsername, $apiPassword)
    {
        if ($apiUsername && $apiPassword) {
            $this->setApiUsername($apiUsername)
                ->setApiPassword($apiPassword);
            $accountInfo = $this->getAccountInfo();

            if (isset($accountInfo->message)) {
                $message = 'VALIDATION ERROR :  ' . $accountInfo->message;
                $this->helper->debug('validate', [$message]);

                return false;
            }

            return $accountInfo;
        }

        return false;
    }
833273
public static function getCustomMenuItems($user)
    {
        $menuItems = [];

        if (array_key_exists('menu', config('laralum'))) {
            foreach (config('laralum.menu') as $custom_menu) {
                $pm = new self();
                $pm->name(ucfirst($custom_menu['title']));
                $pm->items = array_merge($pm->items, static::getPackageMenuItems($custom_menu, $user));

                if (count($pm->items) > 0) {
                    array_push($menuItems, $pm);
                }
            }
        }

        return $menuItems;
    }
176631
protected function getTableRowForUser(User $user)
    {
        $roleNames = [];
        $accountIdentifiers = [];
        foreach ($user->getAccounts() as $account) {
            /** @var Account $account */
            $authenticationProviderName = $account->getAuthenticationProviderName();
            if ($authenticationProviderName !== $this->userService->getDefaultAuthenticationProviderName()) {
                $authenticationProviderLabel = ' (' . (isset($this->authenticationProviderSettings[$authenticationProviderName]['label']) ? $this->authenticationProviderSettings[$authenticationProviderName]['label'] : $authenticationProviderName) . ')';
            } else {
                $authenticationProviderLabel = '';
            }
            $accountIdentifiers[] = $account->getAccountIdentifier() . $authenticationProviderLabel;
            foreach ($account->getRoles() as $role) {
                /** @var Role $role */
                $roleNames[] = $role->getIdentifier();
            }
        }
        return [$user->getName()->getFullName(), $user->getPrimaryElectronicAddress(), implode(', ', $accountIdentifiers), implode(', ', $roleNames), ($user->isActive() ? 'yes' : 'no')];
    }
55067
protected function createMailSettings(Authenticatable $user, Token $token): array
    {
        Carbon::setLocale($this->config->get('app.locale', 'en'));
        $expiry = $this->getTokenExpiry();

        $route = $this->generateRoute($token);

        return [
            'to'            => [['email' => $token->email, 'name' => $user->username ?? $token->email]],

            'view'          => $this->config->get("laranixauth.{$this->configKey}.mail.view"),
            'subject'       => $this->config->get("laranixauth.{$this->configKey}.mail.subject"),
            'markdown'      => $this->config->get("laranixauth.{$this->configKey}.mail.markdown", true),

            'userId'        => $user->getAuthIdentifier(),
            'username'      => $user->username,
            'firstName'     => $user->first_name,
            'lastName'      => $user->last_name,
            'fullName'      => $user->full_name,

            'token'         => $token->token,
            'expiry'        => $expiry->format('jS F Y g:i:sA T'),
            'humanExpiry'   => $expiry->diffForHumans(null, true),
            'url'           => $route,
            'baseurl'       => substr($route, 0, strpos($route, '?')),
        ];
    }
673639
public function getSuccessLines(Event $event, $apiResponse)
    {
        $json = json_decode($apiResponse);
        $json = $json->responseData;

        $messages = [];

        $messages[] = sprintf(
            "%s results [ %s ]",
            (isset($json->cursor->estimatedResultCount)) ? $json->cursor->estimatedResultCount : "0",
            $json->cursor->moreResultsUrl
        );

        return $messages;
    }
943997
private function listUserAuthorizedMetadataFields(User $user)
    {
        $acl = $this->getAclForUser($user);
        $ret = [];

        foreach ($acl->get_granted_sbas() as $databox) {
            $databoxId = $databox->get_sbas_id();
            foreach ($databox->get_meta_structure() as $databox_field) {
                $data = [
                  'name'             => $databox_field->get_name(),
                  'id'               => $databox_field->get_id(),
                  'databox_id'       => $databoxId,
                  'multivalue'       => $databox_field->is_multi(),
                  'indexable'        => $databox_field->is_indexable(),
                  'readonly'         => $databox_field->is_readonly(),
                  'business'         => $databox_field->isBusiness(),
                  'source'           => $databox_field->get_tag()->getTagname(),
                  'labels'           => [
                    'fr' => $databox_field->get_label('fr'),
                    'en' => $databox_field->get_label('en'),
                    'de' => $databox_field->get_label('de'),
                    'nl' => $databox_field->get_label('nl'),
                  ],
                ];
                $ret[] = $data;
            }

            if ($acl->can_see_business_fields($databox) === false) {
                $ret = array_values($this->removeBusinessFields($ret));
            }
        }

        return $ret;
    }
1035599
public static function all($params = null, $apiKey = null)
    {
        return self::_all(get_class(), $params, $apiKey);
    }
903745
public function getUserRoles( core_kernel_classes_Resource $user)
    {
        $returnValue = array();
        // We use a Depth First Search approach to flatten the Roles Graph.
        $rolesProperty = new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_ROLES);
        $rootRoles = $user->getPropertyValuesCollection($rolesProperty);
        
        foreach ($rootRoles->getIterator() as $r){
        	$returnValue[$r->getUri()] = $r;
        	$returnValue = array_merge($returnValue, $this->getIncludedRoles($r));
        }
        
        $returnValue = array_unique($returnValue);
        
        return (array) $returnValue;
    }
82884
def find_by_user(user: str) -> List['ApiKey']:
        
        return [ApiKey.from_db(key) for key in db.get_keys(qb.from_dict({'user': user}))]
161990
public function getSuccessLines(Event $event, $apiResponse)
    {
        $json = json_decode($apiResponse);
        $json = $json->responseData;

        if (isset($json->cursor->estimatedResultCount) && $json->cursor->estimatedResultCount > 0) {
            $messages = [];
            $messages[] = sprintf(
                "%s [ %s ]",
                $json->results[0]->titleNoFormatting,
                $json->results[0]->url
            );
            $messages[] = sprintf("More results: %s", $json->cursor->moreResultsUrl);
        } else {
            $messages = $this->getNoResultsLines($event, $apiResponse);
        }

        return $messages;
    }
965189
private function serializePermissions(User $user)
    {
        $currentUser = $this->tokenStorage->getToken()->getUser();

        $isOwner = $currentUser instanceof User && $currentUser->getUuid() === $user->getUuid();
        $isAdmin = $this->authChecker->isGranted('ROLE_ADMIN'); // todo maybe add those who have access to UserManagement tool

        // todo : move role check elsewhere
        $profileConfig = $this->config->getParameter('profile');
        $editRoles = [];
        if (!empty($profileConfig['roles_edition'])) {
            $editRoles = array_filter($this->tokenStorage->getToken()->getRoles(), function (BaseRole $role) use ($profileConfig) {
                return in_array($role->getRole(), $profileConfig['roles_edition']);
            });
        }

        return [
            'contact' => !$isOwner,
            'edit' => $isAdmin || !empty($editRoles),
            'administrate' => $isAdmin,
            'delete' => $isOwner || $isAdmin, // todo check platform param to now if current user can destroy is account
        ];
    }
571680
public function pullRequests(string $user, string $repo, array $filter = []): array
    {
        $default = [];
        $api = $this->client->api('pull_request');
        $params = [$user, $repo, $filter];

        $refs = $this->callGitHub([$api, 'all'], $params, $default);

        usort($refs, $this->prSorter($user));

        return $refs;
    }
971540
public function getAnnouncementsFromRootAssociations($apiServiceFilterContext = null)
    {
        $result = [];

        foreach ($this->getRootAssociationIDs() as $key => $rootAssociationID) {
            try {
                $result[] = $this->getAnnouncementsFromAssociation($rootAssociationID, $apiServiceFilterContext);
            } catch (ContextException $e) {
                if ($key === count($this->getRootAssociationIDs()) - 1) {
                    throw $e;
                }
            }
        }

        return $result;
    }
1209855
public function loadUserByAPIUser(User $apiUser)
    {
        $eZSyliusUser = $this->eZUserRepository->findOneBy(
            array(
                'eZUserId' => $apiUser->getUserId(),
                'syliusUserType' => $this->syliusUserType,
            )
        );

        if (!$eZSyliusUser instanceof EzSyliusUser) {
            return null;
        }

        return $this->syliusUserRepository->find(
            $eZSyliusUser->getSyliusUserId()
        );
    }