@author Vova Feldman (@svovaf)
@since  2.0.0

@param \FS_User $user

@return \FS_Api
428412
private function get_api_user_scope_by_user( FS_User $user ) {
            return FS_Api::instance(
                $this->_module_id,
                'user',
                $user->id,
                $user->public_key,
                ! $this->is_live(),
                $user->secret_key
            );
        }
1162958
public function manageRoles(User $user)
    {
        $this->authorize('roles', $user);

        $roles = Role::all();

        return view('laralum_users::roles', ['user' => $user, 'roles' => $roles]);
    }
395545
public function store(CreateUserRequest $request, User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_CREATE);

        $user->fill($request->getValidatedData());
        $user->is_active = true;
        $user->save();
        $user->roles()->sync($request->get('roles'));

        $this->transNotification('created', ['name' => $user->full_name], $user->toArray());

        return redirect()->route('admin::auth.users.index');
    }
733558
public function update(User $user)
    {
        $url = 'users/' . $user->getAppuserid();

        return $this->updateObject($url, $user);
    }
366256
public function user($user = 0)
    {
        if (! $this->user->has($user)) {
            $data = new Collection([]);

            $this->user->put($user, $data);
        }

        return $this->user->get($user);
    }
1320824
public function setUser($user)
    {
        if (\is_object($user)) {
            $this->userObject = $user;
            $this->user       = $user->getId();
        } else {
            $this->userObject = null;
            $this->user       = $user;
        }

        return $this;
    }
742759
public function activate(User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_UPDATE);

        try {
            ($active = $user->isActive()) ? $user->deactivate() : $user->activate();

            $message = $this->transNotification(
                $active ? 'disabled' : 'enabled',
                ['name' => $user->full_name],
                $user->toArray()
            );

            return $this->jsonResponseSuccess(compact('message'));
        }
        catch (\Exception $e) {
            return $this->jsonResponseError(['message' => $e->getMessage()], 500);
        }
    }
171706
public function getAll(User $user)
    {
        return array_map(function ($dashboard) {
            return $this->exportDashboard($dashboard);
        }, $this->getRepository()->findBy(['creator' => $user]));
    }
624831
public function includeRoles(User $user)
    {
        $roles = $user->roles;
        return $this->collection($roles, new RoleTransformer());
    }
639178
public function updateUser(User $user)
    {
        $request = $user->toJson();
        $this->client->put(sprintf('/v2/user/%s', $user->getId()), $request);
    }
751512
private function mapUserToCreatedContent(User $user)
    {
        return new CreatedContent([
            'content' => new RestContent(
                $user->contentInfo,
                $this->repository->getLocationService()->loadLocation($user->contentInfo->mainLocationId),
                $this->repository->getContentService()->loadContentByContentInfo($user->contentInfo),
                $this->repository->getContentTypeService()->loadContentType($user->contentInfo->contentTypeId),
                $this->repository->getContentService()->loadRelations($user->versionInfo)
            ),
        ]);
    }
533753
public function add( models\VPN\Server\User $user){
        $rest = $this->getService( self::API_VPN_USER);
        $rest->POST( $user);

        return $rest->getResult( models\VPN\Server\User::class);
    }
426606
public static function can_create_data_request_for_user($user, $requester = null) {
        $usercontext = \context_user::instance($user);

        return has_capability('tool/dataprivacy:makedatarequestsforchildren', $usercontext, $requester);
    }
38196
public function saveUser(User $user, Request $request)
    {
        $user->fill($request->get('user'))
            ->save();

        Alert::info(__('User was saved.'));

        return back();
    }
720445
public function includeContextOptions(User $user)
    {
        $contexts = $user->members;

        return $this->collection($contexts, new ContextOptionTransformer, 'contextOption');
    }
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'])),
        ];
    }
400354
private function fetch(User $user)
    {
        return self::$cache[$user->getId()] = new \ACL($user, $this->app);
    }