Show the user's details.

@param \Arcanesoft\Contracts\Auth\Models\User $user

@return \Illuminate\View\View
549203
public function show(User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_SHOW);

        $user->load(['roles', 'roles.permissions']);

        $this->setTitle($title = trans('auth::users.titles.user-details'));
        $this->addBreadcrumb($title);

        return $this->view('admin.users.show', compact('user'));
    }
460684
public function index($userId)
    {
        try
        {
            $user = $this->users->findById($userId);
            $userPermissions = $user->getPermissions();
            $genericPermissions = $this->permissions->generic();
            $modulePermissions = $this->permissions->module();

            return View::make(Config::get('cpanel::views.users_permission'))
                ->with('user',$user)
                ->with('userPermissions',$userPermissions)
                ->with('genericPermissions',$genericPermissions)
                ->with('modulePermissions',$modulePermissions);
        }
        catch ( UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error', $e->getMessage());
        }
    }
12318
private function mapUserToVersion(User $user, Request $request)
    {
        $content = $this->repository->getContentService()->loadContent($user->id);
        $request->headers->set('Url', $request->getPathInfo());

        return new Version(
            $content,
            $this->repository->getContentTypeService()->loadContentType($content->contentInfo->contentTypeId),
            $this->repository->getContentService()->loadRelations($content->getVersionInfo()),
            $request->getPathInfo()
        );
    }
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;
    }
851861
public function setUserData(User $user)
    {
        $userVarArray = get_object_vars($user);

        foreach ($userVarArray as $key => $value) {
            if ($value !== null) {
                $this->{$key} = $value;
            }
        }
    }
148862
public function showProfileAction(DacorpUser $user)
    {
        $em = $this->getDoctrine()->getManager();

        if ($user instanceof DacorpUser)
            $chosenAvatarFilename = ($user->getCurrentAvatar()) ? $em->getRepository('DacorpExtraBundle:DacorpMedia')->find($user->getCurrentAvatar())->getFilename() : null;

        return $this->render('DacorpExtraBundle:User:showUserProfile.html.twig', array(
            'user' => $user,
            'avatar' => $chosenAvatarFilename
        ));
    }
400354
private function fetch(User $user)
    {
        return self::$cache[$user->getId()] = new \ACL($user, $this->app);
    }
100183
public function getReadIds(User $user)
    {
        return Discussion::leftJoin('discussion_user', 'discussion_user.discussion_id', '=', 'discussions.id')
            ->where('discussion_user.user_id', $user->id)
            ->whereColumn('last_read_post_number', '>=', 'last_post_number')
            ->pluck('id')
            ->all();
    }
1144893
public function view(UserPolicy $user, Message $message)
    {
        if ($user->canDo('message.message.view') && $user->hasRole('admin')) {
            return true;
        }

        return $user->id == $message->user_id && get_class($user) == $message->user_type;
    }
233292
public function setUser(User $user): void
    {
        $this->user = $user;
        $this->user->setAcl($this);

        $userRole = $this->user->getRole();
        if ($userRole != null && !empty($this->rules)) {
            foreach ($this->rules as $role => $rules) {
                if ($userRole == $role) {
                    foreach ($rules as $uri => $rules) {
                        $this->user->setPermissionsOf($uri, (array) explode(',', $rules) /* 'read,write' etc. */);
                    }
                    break;
                }
            }
        }
    }
216177
public function bulletinPresenceWidgetAction(User $user)
    {
        $presences = $this->totauxManager->getMoyennePresence($user);

        $params = array('presences' => $presences);

        return $this->render('LaurentBulletinBundle::BulletinPresenceWidget.html.twig', $params);
    }
1164735
public function getRegistrationSummary(User $user = null)
    {
        $data = $userData = [];

        // Gets user data
        if (null !== $user) {
            $userData = $this->repository->getRegistrationsSummaryForUser($user);
        }

        foreach ($this->appbox->get_databoxes() as $databox) {
            $data[$databox->get_sbas_id()] = [
                // Registrations on databox by type
                'registrations' => [
                    'by-type' => [
                        'inactive'  => [],
                        'accepted'  => [],
                        'in-time'   => [],
                        'out-dated' => [],
                        'pending'   => [],
                        'rejected'  => [],
                    ]
                ],
                // Registration configuration on databox and collections that belong to the databox
                'config' => [
                    'db-name'       => $databox->get_dbname(),
                    'cgu'           => $databox->get_cgus(),
                    'can-register'  => $databox->isRegistrationEnabled(),
                    // Configuration on collection
                    'collections'   => [],
                ]
            ];

            foreach ($databox->get_collections() as $collection) {
                // Sets collection info
                $data[$databox->get_sbas_id()]['config']['collections'][$collection->get_base_id()] = $this->getCollectionSummary($collection, $userData);
                // Sets registration by type
                if (null !== $registration = $this->getUserCollectionRegistration($collection, $userData)) {
                    $data[$databox->get_sbas_id()]['registrations']['by-type'][$registration['type']][] = $registration;
                }
            }
        }

        return $data;
    }
1223769
public function output_user($user) {
        $out = fullname($user, $this->viewfullnames);
        if ($this->extrafields) {
            $displayfields = array();
            foreach ($this->extrafields as $field) {
                $displayfields[] = $user->{$field};
            }
            $out .= ' (' . implode(', ', $displayfields) . ')';
        }
        return $out;
    }
318648
public function edit(User $user)
    {
        return $this->appShellView('user.edit', [
            'user'  => $user,
            'types' => UserTypeProxy::choices(),
            'roles' => RoleProxy::all()
        ]);
    }
733558
public function update(User $user)
    {
        $url = 'users/' . $user->getAppuserid();

        return $this->updateObject($url, $user);
    }
1261380
public function user($user = null)
    {
        if ($user !== null) {
            $this->_user = $user;

            return;
        }

        if ($this->_user === false) {
            if (($session = $this->getSession()) && $session->id) {
                $this->_user = auth()->who($session);
            } else {
                $this->_user = null;
            }
        }

        return $this->_user;
    }
314511
public function loadUser(User $user)
    {
        // Guests do not have a user id. So do not try to load data for guests.
        if ($user->isGuest()) {
            return;
        }

        $this->db->qb([
            'table' => $this->table,
            'field' => [
                'username',
                'display_name',
                'state'
            ],
            'filter' => 'id_user=:id_user',
            'params' => [
                ':id_user' => $user->getId()
            ]
        ]);

        $data = $this->db->single();

        if (!empty($data)) {

            $user->setUsername($data['username']);

            // Use username as display_name when there is no display_name for this user
            $user->setDisplayName(empty($data['display_name']) ? $data['username'] : $data['display_name']);

            // Load the groups the user is in
            $this->db->qb([
                'table' => 'core_users_groups',
                'fields' => 'id_group',
                'filter' => 'id_user=:id_user',
                'params' => [
                    ':id_user' => $user->getId()
                ]
            ]);

            $groups = $this->db->column();

            if (!empty($groups)) {

                $user->groups->set($groups);

                // Create a prepared string and param array to use in query
                $prepared = $this->db->prepareArrayQuery('group', $groups);

                // Get and return the permissions
                $this->db->qb([
                    'table' => 'core_groups_permissions',
                    'fields' => [
                        'storage',
                        'permission'
                    ],
                    'method' => 'SELECT DISTINCT',
                    'filter' => 'id_group IN (' . $prepared['sql'] . ')',
                    'params' => $prepared['values']
                ]);

                $permissions = $this->db->all();

                foreach ($permissions as $perm) {

                    if (!array_key_exists($perm['storage'], $user->permissions)) {
                        $user->permissions[$perm['storage']] = new UserPermissions();
                    }

                    $user->permissions[$perm['storage']]->add($perm['permission']);
                }

                // Is the user an admin?
                if (!empty($user->permissions['Core']->allowedTo('admin'))) {
                    $user->setAdmin(true);
                }
            }
        }
    }