eZPublishCommunityProject  2013.9
eZ\Publish\Core\REST\Client\UserService Class Reference

Implementation of the eZ\Publish\API\Repository\UserServiceinterface. More...

+ Inheritance diagram for eZ\Publish\Core\REST\Client\UserService:
+ Collaboration diagram for eZ\Publish\Core\REST\Client\UserService:

Public Member Functions

 __construct (HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, RequestParser $requestParser)
 
 assignUserToUserGroup (User $user, UserGroup $userGroup)
 Assigns a new user group to the user. More...
 
 createUser (UserCreateStruct $userCreateStruct, array $parentGroups)
 Create a new user. More...
 
 createUserGroup (UserGroupCreateStruct $userGroupCreateStruct, UserGroup $parentGroup)
 Creates a new user group using the data provided in the ContentCreateStruct parameter. More...
 
 deleteUser (User $user)
 This method deletes a user. More...
 
 deleteUserGroup (UserGroup $userGroup)
 Removes a user group. More...
 
 loadAnonymousUser ()
 Loads anonymous user. More...
 
 loadSubUserGroups (UserGroup $userGroup)
 Loads the sub groups of a user group. More...
 
 loadUser ($userId)
 Loads a user. More...
 
 loadUserByCredentials ($login, $password)
 Loads a user for the given login and password. More...
 
 loadUserByLogin ($login)
 Loads a user for the given login. More...
 
 loadUserGroup ($id)
 Loads a user group for the given id. More...
 
 loadUserGroupsOfUser (User $user)
 Loads the user groups ther user belongs to. More...
 
 loadUsersByEmail ($email)
 Loads a user for the given email. More...
 
 loadUsersOfUserGroup (UserGroup $userGroup, $offset=0, $limit=-1)
 Loads the users of a user group. More...
 
 moveUserGroup (UserGroup $userGroup, UserGroup $newParent)
 Moves the user group to another parent. More...
 
 newUserCreateStruct ($login, $email, $password, $mainLanguageCode, $contentType=null)
 Instantiate a user create class. More...
 
 newUserGroupCreateStruct ($mainLanguageCode, $contentType=null)
 Instantiate a user group create class. More...
 
 newUserGroupUpdateStruct ()
 Instantiate a new user group update struct. More...
 
 newUserUpdateStruct ()
 Instantiate a new user update struct. More...
 
 setSession ($id)
 Set session ID. More...
 
 unAssignUserFromUserGroup (User $user, UserGroup $userGroup)
 Removes a user group from the user. More...
 
 updateUser (User $user, UserUpdateStruct $userUpdateStruct)
 Updates a user. More...
 
 updateUserGroup (UserGroup $userGroup, UserGroupUpdateStruct $userGroupUpdateStruct)
 Updates the group profile with fields and meta data. More...
 

Private Attributes

 $client
 
 $inputDispatcher
 
 $outputVisitor
 
 $requestParser
 

Detailed Description

Implementation of the eZ\Publish\API\Repository\UserServiceinterface.

See Also

Constructor & Destructor Documentation

eZ\Publish\Core\REST\Client\UserService::__construct ( HttpClient  $client,
Dispatcher  $inputDispatcher,
Visitor  $outputVisitor,
RequestParser  $requestParser 
)
Parameters
\eZ\Publish\Core\REST\Client\HttpClient$client
\eZ\Publish\Core\REST\Common\Input\Dispatcher$inputDispatcher
\eZ\Publish\Core\REST\Common\Output\Visitor$outputVisitor
\eZ\Publish\Core\REST\Common\RequestParser$requestParser

Member Function Documentation

eZ\Publish\Core\REST\Client\UserService::assignUserToUserGroup ( User  $user,
UserGroup  $userGroup 
)

Assigns a new user group to the user.

Parameters
\eZ\Publish\API\Repository\Values\User\User$user
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to assign the user group to the user
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the user is already in the given user group

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::createUser ( UserCreateStruct  $userCreateStruct,
array  $parentGroups 
)

Create a new user.

The created user is published by this method

Parameters
\eZ\Publish\API\Repository\Values\User\UserCreateStruct$userCreateStructthe data used for creating the user
array$parentGroupsthe groups of type eZ\Publish\API\Repository\Values\User\UserGroupwhichareassignedtotheuseraftercreation@return\eZ\Publish\API\Repository\Values\User\User@throws\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptioniftheauthenticateduserisnotallowedtomovetheusergroup@throws\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionifausergroupwasnotfound@throws\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationExceptionifafieldinthe$userCreateStructisnotvalid@throws\eZ\Publish\API\Repository\Exceptions\ContentValidationExceptionifarequiredfieldismissing@throws\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionifauserwithprovidedloginalreadyexists

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::createUserGroup ( UserGroupCreateStruct  $userGroupCreateStruct,
UserGroup  $parentGroup 
)

Creates a new user group using the data provided in the ContentCreateStruct parameter.

In 4.x in the content type parameter in the profile is ignored

  • the content type is determined via configuration and can be set to null. The returned version is published.
Parameters
\eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct$userGroupCreateStructa structure for setting all necessary data to create this user group
\eZ\Publish\API\Repository\Values\User\UserGroup$parentGroup
Returns
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to create a user group
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the input structure has invalid data
\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationExceptionif a field in the $userGroupCreateStruct is not valid
\eZ\Publish\API\Repository\Exceptions\ContentValidationExceptionif a required field is missing

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::deleteUser ( User  $user)

This method deletes a user.

Parameters
\eZ\Publish\API\Repository\Values\User\User$user
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to delete the user

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::deleteUserGroup ( UserGroup  $userGroup)

Removes a user group.

the users which are not assigned to other groups will be deleted.

Parameters
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to create a user group

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::loadAnonymousUser ( )

Loads anonymous user.

loadUser()

Returns

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::loadSubUserGroups ( UserGroup  $userGroup)

Loads the sub groups of a user group.

Parameters
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup
Returns
[]
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to read the user group

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::loadUser (   $userId)

Loads a user.

Parameters
mixed$userId
Returns
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif a user with the given id was not found

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::loadUserByCredentials (   $login,
  $password 
)

Loads a user for the given login and password.

Parameters
string$login
string$passwordthe plain password
Returns
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif a user with the given credentials was not found

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::loadUserByLogin (   $login)

Loads a user for the given login.

Parameters
string$login
Returns
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif a user with the given credentials was not found

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::loadUserGroup (   $id)

Loads a user group for the given id.

Parameters
mixed$id
Returns
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to create a user group
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the user group with the given id was not found

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::loadUserGroupsOfUser ( User  $user)

Loads the user groups ther user belongs to.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed read the user or user group
Parameters
\eZ\Publish\API\Repository\Values\User\User$user
Returns
[]

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::loadUsersByEmail (   $email)

Loads a user for the given email.

Returns an array of Users since eZ Publish has under certain circumstances allowed several users having same email in the past (by means of a configuration option).

Parameters
string$email
Returns
[]

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::loadUsersOfUserGroup ( UserGroup  $userGroup,
  $offset = 0,
  $limit = -1 
)

Loads the users of a user group.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to read the users or user group
Parameters
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup
int$offset
int$limit
Returns
[]

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::moveUserGroup ( UserGroup  $userGroup,
UserGroup  $newParent 
)

Moves the user group to another parent.

Parameters
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup
\eZ\Publish\API\Repository\Values\User\UserGroup$newParent
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to move the user group

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::newUserCreateStruct (   $login,
  $email,
  $password,
  $mainLanguageCode,
  $contentType = null 
)

Instantiate a user create class.

Parameters
string$loginthe login of the new user
string$emailthe email of the new user
string$passwordthe plain password of the new user
string$mainLanguageCodethe main language for the underlying content object
\eZ\Publish\API\Repository\Values\ContentType\ContentType$contentType5.x the content type for the underlying content object. In 4.x it is ignored and taken from the configuration
Returns

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::newUserGroupCreateStruct (   $mainLanguageCode,
  $contentType = null 
)

Instantiate a user group create class.

Parameters
string$mainLanguageCodeThe main language for the underlying content object
\eZ\Publish\API\Repository\Values\ContentType\ContentType$contentType5.x the content type for the underlying content object. In 4.x it is ignored and taken from the configuration
Returns

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::newUserGroupUpdateStruct ( )

Instantiate a new user group update struct.

Returns

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::newUserUpdateStruct ( )

Instantiate a new user update struct.

Returns

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::setSession (   $id)

Set session ID.

Only for testing

Parameters
mixedtringid
Returns
void

Implements eZ\Publish\Core\REST\Client\Sessionable.

eZ\Publish\Core\REST\Client\UserService::unAssignUserFromUserGroup ( User  $user,
UserGroup  $userGroup 
)

Removes a user group from the user.

Parameters
\eZ\Publish\API\Repository\Values\User\User$user
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to remove the user group from the user
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the user is not in the given user group

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::updateUser ( User  $user,
UserUpdateStruct  $userUpdateStruct 
)

Updates a user.

4.x: If the versionUpdateStruct is set in the user update structure, this method internally creates a content draft, updates ts with the provided data and publishes the draft. If a draft is explititely required, the user group can be updated via the content service methods.

Parameters
\eZ\Publish\API\Repository\Values\User\User$user
\eZ\Publish\API\Repository\Values\User\UserUpdateStruct$userUpdateStruct
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to update the user
\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationExceptionif a field in the $userUpdateStruct is not valid
\eZ\Publish\API\Repository\Exceptions\ContentValidationExceptionif a required field is set empty
Returns

Implements eZ\Publish\API\Repository\UserService.

eZ\Publish\Core\REST\Client\UserService::updateUserGroup ( UserGroup  $userGroup,
UserGroupUpdateStruct  $userGroupUpdateStruct 
)

Updates the group profile with fields and meta data.

4.x: If the versionUpdateStruct is set in $userGroupUpdateStruct, this method internally creates a content draft, updates ts with the provided data and publishes the draft. If a draft is explititely required, the user group can be updated via the content service methods.

Parameters
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup
\eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct$userGroupUpdateStruct
Returns
Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to move the user group
\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationExceptionif a field in the $userGroupUpdateStruct is not valid
\eZ\Publish\API\Repository\Exceptions\ContentValidationExceptionif a required field is set empty

Implements eZ\Publish\API\Repository\UserService.

Member Data Documentation

eZ\Publish\Core\REST\Client\UserService::$client
private
eZ\Publish\Core\REST\Client\UserService::$inputDispatcher
private
eZ\Publish\Core\REST\Client\UserService::$outputVisitor
private
eZ\Publish\Core\REST\Client\UserService::$requestParser
private

The documentation for this class was generated from the following file: