@param User $user

@return string
518246
public function generateAvatar(User $user)
    {
        if ($user->getAvatar()) {
            return $this->uploadDir['web_path'].$user->getAvatar();
        } else {
            return $this->container->getParameter('symfonyid.admin.user.default_avatar');
        }
    }
720445
public function includeContextOptions(User $user)
    {
        $contexts = $user->members;

        return $this->collection($contexts, new ContextOptionTransformer, 'contextOption');
    }
1304217
public function edit(User $user)
    {
        $roles         = $this->getAllowedRoles();
        $selectedRoles = $user->roles()->pluck('roles.id');

        return view('administrator.users.edit', compact('user', 'roles', 'selectedRoles'));
    }
733558
public function update(User $user)
    {
        $url = 'users/' . $user->getAppuserid();

        return $this->updateObject($url, $user);
    }
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;
    }
476560
public function create(User $user)
    {
        /* handle encode */
        $user = $this->encode($user);

        $this->getEm()->persist($user);
        $this->getEm()->flush();

        return $user;
    }
889958
protected function getUserId($user)
    {
        if (is_null($user))
        {
            $user = auth()->user();
        }

        if ($user instanceof Model)
        {
            $user = $user->getKey();
        }

        return $user;
    }
1238953
private function getPermissionTable(User $user) {
		$userId = $user->getId();
		if ($this->permissionTable->has($userId)) {
			return $this->permissionTable->get($userId);
		}

		// always allow what guests can do
		$guestGroup = GroupQuery::create()->findOneByIsGuest(true);

		// collect groups from user
		$groups = GroupQuery::create()->filterByUser($user)->find();
		$userGroup = GroupQuery::create()->filterByOwnerId(($userId))->findOne();
		if ($userGroup) {
			$groups[] = $userGroup;
		}
		$groups[] = $guestGroup;

		// ... structure them
		$permissionTable = new Set();
		foreach ($groups as $group) {
			foreach ($group->getActions() as $action) {
				$permissionTable->add($action->getId());
			}
		}

		$this->permissionTable->set($userId, $permissionTable);

		return $this->permissionTable->get($userId);
	}
441654
public function getNotificationsReadAction(User $user)
    {
        $this->notificationManager->markAllNotificationsAsViewed($user->getId());

        return $this->notificationManager->getUserNotifications($user);
    }
652756
public function generatePublicUrl(User $user)
    {
        $publicUrl = $user->getFirstName() . '.' . $user->getLastName();
        $publicUrl = strtolower(str_replace(' ', '-', $publicUrl));
        $searchedUsers = $this->objectManager->getRepository('ClarolineCoreBundle:User')->findOneByPublicUrl($publicUrl);

        if (null !== $searchedUsers) $publicUrl .= '_' . uniqid();

        return $publicUrl;
    }
1173382
public function persistUser(User $user)
    {
        $this->objectManager->persist($user);
        $this->objectManager->flush();

        return $user;
    }
888946
public function edit(User $user)
    {
        $roles = Role::all();
        $permissions = Permission::all();
        return view('chuckcms::backend.users.edit', compact('user', 'roles', 'permissions'));
    }
675648
public function format($user)
    {
        $id = null;
        $name = '';
        $userInfo = null;
        if (isset($user) && $user) {
            if (is_int($user) || (is_string($user) && is_numeric($user))) {
                $user = \User::getByUserID($user);
            }
            try {
                if ($user instanceof ConcreteUser && $user->getUserID() && $user->isRegistered()) {
                    $id = (int) $user->getUserID();
                    $name = $user->getUserName();
                } elseif ($user instanceof UserInfo && $user->getUserID()) {
                    $id = (int) $user->getUserID();
                    $name = $user->getUserName();
                    $userInfo = $user;
                } elseif ($user instanceof ConcreteUserEntity && $user->getUserID()) {
                    $id = (int) $user->getUserID();
                    $name = $user->getUserName();
                }
            } catch (EntityNotFoundException $x) {
                $id = null;
            }
        }
        if ($id === null) {
            $result = '<i class="comtra-user comtra-user-removed">' . t('removed user') . '</i>';
        } elseif ($id == USER_SUPER_ID) {
            $result = '<i class="comtra-user comtra-user-system">' . t('system') . '</i>';
        } else {
            $profileURL = null;
            if ($userInfo === null) {
                $userInfo = $this->app->make(UserInfoRepository::class)->getByID($id);
            }
            if ($userInfo !== null) {
                $profileURL = $userInfo->getUserPublicProfileUrl();
            }
            if ($profileURL === null) {
                $result = '<span';
            } else {
                $result = '<a href="' . h((string) $profileURL) . '"';
            }
            $result .= ' class="comtra-user comtra-user-found">' . h($name);
            if ($profileURL === null) {
                $result .= '</span>';
            } else {
                $result .= '</a>';
            }
        }

        return $result;
    }
233355
public function getUserEntity($user)
    {
        if (is_numeric($user)) {
            $userEntity = $this->entityTypeManager
                ->getStorage('user')
                ->load($user);
        } else {
            $userEntities = $this->entityTypeManager
                ->getStorage('user')
                ->loadByProperties(['name' => $user]);
            $userEntity = reset($userEntities);
        }

        return $userEntity;
    }
474823
protected function getNameFromUser($user)
    {
        switch (true) {
            // favour (potentially) unchanging user credentials
            case $user instanceof Contracts\UniversallyIdentifiable:
                return $user->getUuid();

            case $user instanceof AuthenticatableContract:
                return $user->getAuthIdentifier();

            case $user instanceof Contracts\Identifiable:
                return $user->getId();

            case $user instanceof Contracts\Nameable:
                return $user->getName();

            default:
                return null;
        }
    }
948244
public function contactLinkTechnical(User $user): string
    {
        return I18N::translate('For technical support and information contact %s.', $this->user_service->contactLink($user));
    }
701028
public function removeUser(User $user)
    {
        if ($this->users->contains($user)) {
            $this->users->removeElement($user);
        }

        return $this;
    }