Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Core/REST/Client/UserService.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Client;
8
9 use DateTimeInterface;
10 use eZ\Publish\API\Repository\UserService as APIUserService;
11 use eZ\Publish\API\Repository\Values\Content\Content;
12 use eZ\Publish\API\Repository\Values\User\PasswordInfo;
13 use eZ\Publish\API\Repository\Values\User\PasswordValidationContext;
14 use eZ\Publish\API\Repository\Values\User\User;
15 use eZ\Publish\API\Repository\Values\User\UserCreateStruct;
16 use eZ\Publish\API\Repository\Values\User\UserTokenUpdateStruct;
17 use eZ\Publish\API\Repository\Values\User\UserUpdateStruct;
18 use eZ\Publish\API\Repository\Values\User\UserGroup;
19 use eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct;
20 use eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct;
21 use eZ\Publish\Core\REST\Common\RequestParser;
22 use eZ\Publish\Core\REST\Common\Input\Dispatcher;
23 use eZ\Publish\Core\REST\Common\Output\Visitor;
24
31 class UserService implements APIUserService, Sessionable
32 {
34 private $client;
35
37 private $inputDispatcher;
38
40 private $outputVisitor;
41
43 private $requestParser;
44
51 public function __construct(HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, RequestParser $requestParser)
52 {
53 $this->client = $client;
54 $this->inputDispatcher = $inputDispatcher;
55 $this->outputVisitor = $outputVisitor;
56 $this->requestParser = $requestParser;
57 }
58
68 public function setSession($id)
69 {
70 if ($this->outputVisitor instanceof Sessionable) {
71 $this->outputVisitor->setSession($id);
72 }
73 }
74
92 public function createUserGroup(UserGroupCreateStruct $userGroupCreateStruct, UserGroup $parentGroup)
93 {
94 throw new \Exception('@todo: Implement.');
95 }
96
100 public function loadUserGroup($id, array $prioritizedLanguages = [])
101 {
102 throw new \Exception('@todo: Implement.');
103 }
104
108 public function loadSubUserGroups(UserGroup $userGroup, $offset = 0, $limit = 25, array $prioritizedLanguages = [])
109 {
110 throw new \Exception('@todo: Implement.');
111 }
112
122 public function deleteUserGroup(UserGroup $userGroup)
123 {
124 throw new \Exception('@todo: Implement.');
125 }
126
135 public function moveUserGroup(UserGroup $userGroup, UserGroup $newParent)
136 {
137 throw new \Exception('@todo: Implement.');
138 }
139
155 public function updateUserGroup(UserGroup $userGroup, UserGroupUpdateStruct $userGroupUpdateStruct)
156 {
157 throw new \Exception('@todo: Implement.');
158 }
159
174 public function createUser(UserCreateStruct $userCreateStruct, array $parentGroups)
175 {
176 throw new \Exception('@todo: Implement.');
177 }
178
182 public function loadUser($userId, array $prioritizedLanguages = [])
183 {
184 throw new \Exception('@todo: Implement.');
185 }
186
195 public function loadAnonymousUser()
196 {
197 throw new \Exception('@todo: Implement.');
198 }
199
203 public function loadUserByCredentials($login, $password, array $prioritizedLanguages = [])
204 {
205 throw new \Exception('@todo: Implement.');
206 }
207
211 public function checkUserCredentials(User $user, string $credentials): bool
212 {
213 throw new \Exception('@todo: Implement.');
214 }
215
219 public function loadUserByLogin($login, array $prioritizedLanguages = [])
220 {
221 throw new \Exception('@todo: Implement.');
222 }
223
227 public function loadUsersByEmail($email, array $prioritizedLanguages = [])
228 {
229 throw new \Exception('@todo: Implement.');
230 }
231
240 public function loadUserByToken($hash, array $prioritizedLanguages = [])
241 {
242 throw new \Exception('@todo: Implement.');
243 }
244
252 public function deleteUser(User $user)
253 {
254 throw new \Exception('@todo: Implement.');
255 }
256
272 public function updateUser(User $user, UserUpdateStruct $userUpdateStruct)
273 {
274 throw new \Exception('@todo: Implement.');
275 }
276
285 public function updateUserToken(User $user, UserTokenUpdateStruct $userTokenUpdateStruct)
286 {
287 throw new \Exception('@todo: Implement.');
288 }
289
295 public function expireUserToken($hash)
296 {
297 throw new \Exception('@todo: Implement.');
298 }
299
300
310 public function assignUserToUserGroup(User $user, UserGroup $userGroup)
311 {
312 throw new \Exception('@todo: Implement.');
313 }
314
324 public function unAssignUserFromUserGroup(User $user, UserGroup $userGroup)
325 {
326 throw new \Exception('@todo: Implement.');
327 }
328
332 public function loadUserGroupsOfUser(User $user, $offset = 0, $limit = 25, array $prioritizedLanguages = [])
333 {
334 throw new \Exception('@todo: Implement.');
335 }
336
340 public function loadUsersOfUserGroup(
341 UserGroup $userGroup,
342 $offset = 0,
343 $limit = 25,
344 array $prioritizedLanguages = []
345 ) {
346 throw new \Exception('@todo: Implement.');
347 }
348
352 public function isUser(Content $content): bool
353 {
354 foreach ($content->getFields() as $field) {
355 if ($field->fieldTypeIdentifier === 'ezuser') {
356 return true;
357 }
358 }
359
360 return false;
361 }
362
366 public function isUserGroup(Content $content): bool
367 {
368 // TODO: Need a way to identify user groups her. Config is an option, lookup another but not an ideal solution.
369 return false;
370 }
371
383 public function newUserCreateStruct($login, $email, $password, $mainLanguageCode, $contentType = null)
384 {
385 throw new \Exception('@todo: Implement.');
386 }
387
396 public function newUserGroupCreateStruct($mainLanguageCode, $contentType = null)
397 {
398 throw new \Exception('@todo: Implement.');
399 }
400
406 public function newUserUpdateStruct()
407 {
408 throw new \Exception('@todo: Implement.');
409 }
410
416 public function newUserGroupUpdateStruct()
417 {
418 throw new \Exception('@todo: Implement.');
419 }
420
424 public function validatePassword(string $password, PasswordValidationContext $context = null): array
425 {
426 throw new \Exception('@todo: Implement.');
427 }
428
429 public function getPasswordInfo(User $user): PasswordInfo
430 {
431 throw new \Exception('@todo: Implement.');
432 }
433 }
eZ\Publish\API\Repository\Values\Content\Content
Definition: Publish/API/Repository/Values/Content/Content.php:21
eZ\Publish\API\Repository\Values\Content\Content\getFields
getFields()
This method returns the complete fields collection.
eZ\Publish\API\Repository\Values\User\PasswordInfo
Definition: PasswordInfo.php:16
eZ\Publish\API\Repository\Values\User\PasswordValidationContext
Definition: PasswordValidationContext.php:20
eZ\Publish\API\Repository\Values\User\UserCreateStruct
This class is used to create a new user in the repository.
Definition: API/Repository/Values/User/UserCreateStruct.php:15
eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct
This class is used to create a new user group in the repository.
Definition: API/Repository/Values/User/UserGroupCreateStruct.php:15
eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct
This class is used to update a user group in the repository.
Definition: UserGroupUpdateStruct.php:15
eZ\Publish\API\Repository\Values\User\UserGroup
Definition: API/Repository/Values/User/UserGroup.php:17
eZ\Publish\API\Repository\Values\User\UserTokenUpdateStruct
This class is used to update a user token in the repository.
Definition: API/Repository/Values/User/UserTokenUpdateStruct.php:15
eZ\Publish\API\Repository\Values\User\UserUpdateStruct
This class is used to update a user in the repository.
Definition: UserUpdateStruct.php:15
eZ\Publish\API\Repository\Values\User\User
Definition: Publish/API/Repository/Values/User/User.php:24
eZ\Publish\Core\REST\Client\UserService
Implementation of the \eZ\Publish\API\Repository\UserService interface.
Definition: Core/REST/Client/UserService.php:32
eZ\Publish\Core\REST\Client\UserService\setSession
setSession($id)
Set session ID.
Definition: Core/REST/Client/UserService.php:68
eZ\Publish\Core\REST\Client\UserService\checkUserCredentials
checkUserCredentials(User $user, string $credentials)
{Checks if credentials are valid for provided User.bool}
Definition: Core/REST/Client/UserService.php:211
eZ\Publish\Core\REST\Client\UserService\loadUserGroupsOfUser
loadUserGroupsOfUser(User $user, $offset=0, $limit=25, array $prioritizedLanguages=[])
{Loads the user groups the user belongs to.}
Definition: Core/REST/Client/UserService.php:332
eZ\Publish\Core\REST\Client\UserService\updateUser
updateUser(User $user, UserUpdateStruct $userUpdateStruct)
Updates a user.
Definition: Core/REST/Client/UserService.php:272
eZ\Publish\Core\REST\Client\UserService\loadSubUserGroups
loadSubUserGroups(UserGroup $userGroup, $offset=0, $limit=25, array $prioritizedLanguages=[])
{Loads the sub groups of a user group.the start offset for paging the number of user groups returned ...
Definition: Core/REST/Client/UserService.php:108
eZ\Publish\Core\REST\Client\UserService\__construct
__construct(HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, RequestParser $requestParser)
Definition: Core/REST/Client/UserService.php:51
eZ\Publish\Core\REST\Client\UserService\newUserGroupUpdateStruct
newUserGroupUpdateStruct()
Instantiate a new user group update struct.
Definition: Core/REST/Client/UserService.php:416
eZ\Publish\Core\REST\Client\UserService\newUserUpdateStruct
newUserUpdateStruct()
Instantiate a new user update struct.
Definition: Core/REST/Client/UserService.php:406
eZ\Publish\Core\REST\Client\UserService\isUserGroup
isUserGroup(Content $content)
{Checks if Content is a user group.7.4bool}
Definition: Core/REST/Client/UserService.php:366
eZ\Publish\Core\REST\Client\UserService\loadUsersOfUserGroup
loadUsersOfUserGroup(UserGroup $userGroup, $offset=0, $limit=25, array $prioritizedLanguages=[])
{Loads the users of a user group.}
Definition: Core/REST/Client/UserService.php:340
eZ\Publish\Core\REST\Client\UserService\loadUsersByEmail
loadUsersByEmail($email, array $prioritizedLanguages=[])
{Loads a user for the given email.Note: This method loads user by $email where $email might be case-i...
Definition: Core/REST/Client/UserService.php:227
eZ\Publish\Core\REST\Client\UserService\moveUserGroup
moveUserGroup(UserGroup $userGroup, UserGroup $newParent)
Moves the user group to another parent.
Definition: Core/REST/Client/UserService.php:135
eZ\Publish\Core\REST\Client\UserService\expireUserToken
expireUserToken($hash)
Expires user token with user hash.
Definition: Core/REST/Client/UserService.php:295
eZ\Publish\Core\REST\Client\UserService\loadUser
loadUser($userId, array $prioritizedLanguages=[])
{Loads a user.Used as prioritized language code on translated properties of returned object....
Definition: Core/REST/Client/UserService.php:182
eZ\Publish\Core\REST\Client\UserService\$requestParser
$requestParser
Definition: Core/REST/Client/UserService.php:43
eZ\Publish\Core\REST\Client\UserService\createUser
createUser(UserCreateStruct $userCreateStruct, array $parentGroups)
Create a new user.
Definition: Core/REST/Client/UserService.php:174
eZ\Publish\Core\REST\Client\UserService\deleteUser
deleteUser(User $user)
This method deletes a user.
Definition: Core/REST/Client/UserService.php:252
eZ\Publish\Core\REST\Client\UserService\$client
$client
Definition: Core/REST/Client/UserService.php:34
eZ\Publish\Core\REST\Client\UserService\loadUserByLogin
loadUserByLogin($login, array $prioritizedLanguages=[])
{Loads a user for the given login.Since 6.1 login is case-insensitive across all storage engines and ...
Definition: Core/REST/Client/UserService.php:219
eZ\Publish\Core\REST\Client\UserService\getPasswordInfo
getPasswordInfo(User $user)
Returns information about password for a given user.
Definition: Core/REST/Client/UserService.php:429
eZ\Publish\Core\REST\Client\UserService\deleteUserGroup
deleteUserGroup(UserGroup $userGroup)
Removes a user group.
Definition: Core/REST/Client/UserService.php:122
eZ\Publish\Core\REST\Client\UserService\createUserGroup
createUserGroup(UserGroupCreateStruct $userGroupCreateStruct, UserGroup $parentGroup)
Creates a new user group using the data provided in the ContentCreateStruct parameter.
Definition: Core/REST/Client/UserService.php:92
eZ\Publish\Core\REST\Client\UserService\loadUserGroup
loadUserGroup($id, array $prioritizedLanguages=[])
{Loads a user group for the given id.Used as prioritized language code on translated properties of re...
Definition: Core/REST/Client/UserService.php:100
eZ\Publish\Core\REST\Client\UserService\updateUserGroup
updateUserGroup(UserGroup $userGroup, UserGroupUpdateStruct $userGroupUpdateStruct)
Updates the group profile with fields and meta data.
Definition: Core/REST/Client/UserService.php:155
eZ\Publish\Core\REST\Client\UserService\unAssignUserFromUserGroup
unAssignUserFromUserGroup(User $user, UserGroup $userGroup)
Removes a user group from the user.
Definition: Core/REST/Client/UserService.php:324
eZ\Publish\Core\REST\Client\UserService\newUserGroupCreateStruct
newUserGroupCreateStruct($mainLanguageCode, $contentType=null)
Instantiate a user group create class.
Definition: Core/REST/Client/UserService.php:396
eZ\Publish\Core\REST\Client\UserService\assignUserToUserGroup
assignUserToUserGroup(User $user, UserGroup $userGroup)
Assigns a new user group to the user.
Definition: Core/REST/Client/UserService.php:310
eZ\Publish\Core\REST\Client\UserService\loadUserByCredentials
loadUserByCredentials($login, $password, array $prioritizedLanguages=[])
{Loads a user for the given login and password.Since 6.1 login is case-insensitive across all storage...
Definition: Core/REST/Client/UserService.php:203
eZ\Publish\Core\REST\Client\UserService\$inputDispatcher
$inputDispatcher
Definition: Core/REST/Client/UserService.php:37
eZ\Publish\Core\REST\Client\UserService\loadUserByToken
loadUserByToken($hash, array $prioritizedLanguages=[])
Loads a user with user hash key.
Definition: Core/REST/Client/UserService.php:240
eZ\Publish\Core\REST\Client\UserService\updateUserToken
updateUserToken(User $user, UserTokenUpdateStruct $userTokenUpdateStruct)
Update the user token information specified by the user token struct.
Definition: Core/REST/Client/UserService.php:285
eZ\Publish\Core\REST\Client\UserService\loadAnonymousUser
loadAnonymousUser()
Loads anonymous user.
Definition: Core/REST/Client/UserService.php:195
eZ\Publish\Core\REST\Client\UserService\newUserCreateStruct
newUserCreateStruct($login, $email, $password, $mainLanguageCode, $contentType=null)
Instantiate a user create class.
Definition: Core/REST/Client/UserService.php:383
eZ\Publish\Core\REST\Client\UserService\isUser
isUser(Content $content)
{Checks if Content is a user.7.4bool}
Definition: Core/REST/Client/UserService.php:352
eZ\Publish\Core\REST\Client\UserService\validatePassword
validatePassword(string $password, PasswordValidationContext $context=null)
{Validates given password.}
Definition: Core/REST/Client/UserService.php:424
eZ\Publish\Core\REST\Client\UserService\$outputVisitor
$outputVisitor
Definition: Core/REST/Client/UserService.php:40
eZ\Publish\Core\REST\Common\Input\Dispatcher
Input dispatcher.
Definition: Dispatcher.php:16
eZ\Publish\Core\REST\Common\Output\Visitor
Visits a value object into an HTTP Response.
Definition: Visitor.php:15
eZ\Publish\API\Repository\UserService
Definition: API/Repository/UserService.php:26
eZ\Publish\Core\REST\Client\HttpClient
Interface for Http Client implementations.
Definition: REST/Client/HttpClient.php:15
eZ\Publish\Core\REST\Client\Sessionable
Implementation of the \eZ\Publish\API\Repository\SectionService interface.
Definition: Sessionable.php:16
eZ\Publish\Core\REST\Common\RequestParser
Interface for Request parsers.
Definition: RequestParser.php:13
eZ\Publish\Core\REST\Client
Definition: Core/REST/Client/ContentService.php:7
eZ\Publish\Core\REST\Common\RequestParser
Definition: EzPublish.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.