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

Core/REST/Client/RoleService.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Client;
8
9 use eZ\Publish\API\Repository\RoleService as APIRoleService;
10 use eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation;
11 use eZ\Publish\API\Repository\Values\User\Policy as APIPolicy;
12 use eZ\Publish\API\Repository\Values\User\PolicyCreateStruct as APIPolicyCreateStruct;
13 use eZ\Publish\API\Repository\Values\User\PolicyDraft;
14 use eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct as APIPolicyUpdateStruct;
15 use eZ\Publish\API\Repository\Values\User\Role as APIRole;
16 use eZ\Publish\API\Repository\Values\User\RoleAssignment as APIRoleAssignment;
17 use eZ\Publish\API\Repository\Values\User\RoleDraft as APIRoleDraft;
18 use eZ\Publish\API\Repository\Values\User\RoleCreateStruct as APIRoleCreateStruct;
19 use eZ\Publish\API\Repository\Values\User\RoleUpdateStruct;
20 use eZ\Publish\API\Repository\Values\User\User;
21 use eZ\Publish\API\Repository\Values\User\UserGroup;
22 use eZ\Publish\Core\Repository\Values\User\RoleDraft;
23 use eZ\Publish\Core\Repository\Values\User\UserRoleAssignment;
24 use eZ\Publish\Core\Repository\Values\User\UserGroupRoleAssignment;
25 use eZ\Publish\Core\REST\Client\Values\User\PolicyCreateStruct;
26 use eZ\Publish\Core\REST\Client\Values\User\PolicyUpdateStruct;
27 use eZ\Publish\Core\REST\Client\Values\User\Role;
28 use eZ\Publish\Core\REST\Client\Values\User\Policy;
29 use eZ\Publish\Core\REST\Client\Values\User\RoleAssignment;
30 use eZ\Publish\Core\REST\Common\RequestParser;
31 use eZ\Publish\Core\REST\Common\Input\Dispatcher;
32 use eZ\Publish\Core\REST\Common\Output\Visitor;
33 use eZ\Publish\Core\REST\Common\Message;
34
41 class RoleService implements APIRoleService, Sessionable
42 {
44 private $userService;
45
47 private $client;
48
50 private $inputDispatcher;
51
53 private $outputVisitor;
54
56 private $requestParser;
57
65 public function __construct(UserService $userService, HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, RequestParser $requestParser)
66 {
67 $this->userService = $userService;
68 $this->client = $client;
69 $this->inputDispatcher = $inputDispatcher;
70 $this->outputVisitor = $outputVisitor;
71 $this->requestParser = $requestParser;
72 }
73
83 public function setSession($id)
84 {
85 if ($this->outputVisitor instanceof Sessionable) {
86 $this->outputVisitor->setSession($id);
87 }
88 }
89
103 public function createRoleDraft(APIRole $role)
104 {
105 //TODO
106 }
107
120 public function loadRoleDraft($id)
121 {
122 //TODO
123 }
124
135 public function loadRoleDraftByRoleId($roleId)
136 {
137 // TODO
138 }
139
153 public function updateRoleDraft(APIRoleDraft $roleDraft, RoleUpdateStruct $roleUpdateStruct)
154 {
155 //TODO
156 }
157
173 public function addPolicyByRoleDraft(APIRoleDraft $roleDraft, APIPolicyCreateStruct $policyCreateStruct)
174 {
175 //TODO
176 }
177
188 public function removePolicyByRoleDraft(APIRoleDraft $roleDraft, PolicyDraft $policyDraft)
189 {
190 //TODO
191 }
192
210 public function updatePolicyByRoleDraft(APIRoleDraft $roleDraft, PolicyDraft $policy, APIPolicyUpdateStruct $policyUpdateStruct)
211 {
212 //TODO
213 }
214
224 public function deleteRoleDraft(APIRoleDraft $roleDraft)
225 {
226 //TODO
227 }
228
238 public function publishRoleDraft(APIRoleDraft $roleDraft)
239 {
240 //TODO
241 }
242
256 public function createRole(APIRoleCreateStruct $roleCreateStruct)
257 {
258 $inputMessage = $this->outputVisitor->visit($roleCreateStruct);
259 $inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType('Role');
260
261 $result = $this->client->request(
262 'POST',
263 $this->requestParser->generate('roles'),
264 $inputMessage
265 );
266
267 $createdRole = $this->inputDispatcher->parse($result);
268 $createdRoleValues = $this->requestParser->parse('role', $createdRole->id);
269
270 $createdPolicies = array();
271 foreach ($roleCreateStruct->getPolicies() as $policyCreateStruct) {
272 $inputMessage = $this->outputVisitor->visit($policyCreateStruct);
273 $inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType('Policy');
274
275 $result = $this->client->request(
276 'POST',
277 $this->requestParser->generate('policies', array('role' => $createdRoleValues['role'])),
278 $inputMessage
279 );
280
281 $createdPolicy = $this->inputDispatcher->parse($result);
282
283 // @todo Workaround for missing roleId in Policy XSD definition
284 $createdPolicyArray = array(
285 'id' => $createdPolicy->id,
286 'roleId' => $createdRole->id,
287 'module' => $createdPolicy->module,
288 'function' => $createdPolicy->function,
289 );
290
291 $createdPolicy = new Policy($createdPolicyArray);
292 $createdPolicies[] = $createdPolicy;
293 }
294
295 return new RoleDraft(
296 array(
297 'id' => $createdRole->id,
298 'identifier' => $createdRole->identifier,
299 ),
300 $createdPolicies
301 );
302 }
303
317 public function updateRole(APIRole $role, RoleUpdateStruct $roleUpdateStruct)
318 {
319 $inputMessage = $this->outputVisitor->visit($roleUpdateStruct);
320 $inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType('Role');
321 $inputMessage->headers['X-HTTP-Method-Override'] = 'PATCH';
322
323 $result = $this->client->request(
324 'POST',
325 $role->id,
326 $inputMessage
327 );
328
329 return $this->inputDispatcher->parse($result);
330 }
331
347 public function addPolicy(APIRole $role, APIPolicyCreateStruct $policyCreateStruct)
348 {
349 $values = $this->requestParser->parse('role', $role->id);
350 $inputMessage = $this->outputVisitor->visit($policyCreateStruct);
351 $inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType('Policy');
352
353 $result = $this->client->request(
354 'POST',
355 $this->requestParser->generate('policies', array('role' => $values['role'])),
356 $inputMessage
357 );
358
359 $createdPolicy = $this->inputDispatcher->parse($result);
360
361 // @todo Workaround for missing roleId in Policy XSD definition
362 $createdPolicyArray = array(
363 'id' => $createdPolicy->id,
364 'roleId' => $role->id,
365 'module' => $createdPolicy->module,
366 'function' => $createdPolicy->function,
367 );
368
369 $createdPolicy = new Policy($createdPolicyArray);
370
371 $existingPolicies = $role->getPolicies();
372 $existingPolicies[] = $createdPolicy;
373
374 return new Role(
375 array(
376 'id' => $role->id,
377 'identifier' => $role->identifier,
378 ),
379 $existingPolicies
380 );
381 }
382
396 public function removePolicy(APIRole $role, APIPolicy $policy)
397 {
398 $values = $this->requestParser->parse('role', $role->id);
399 $response = $this->client->request(
400 'DELETE',
401 $this->requestParser->generate(
402 'policy',
403 array(
404 'role' => $values['role'],
405 'policy' => $policy->id,
406 )
407 ),
408 new Message(
409 // @todo: What media-type should we set here? Actually, it should be
410 // all expected exceptions + none? Or is "Section" correct,
411 // since this is what is to be expected by the resource
412 // identified by the URL?
413 array('Accept' => $this->outputVisitor->getMediaType('Policy'))
414 )
415 );
416
417 if (!empty($response->body)) {
418 $this->inputDispatcher->parse($response);
419 }
420
421 return $this->loadRole($role->id);
422 }
423
433 public function deletePolicy(APIPolicy $policy)
434 {
435 throw new \Exception('@todo: Implement.');
436 }
437
454 public function updatePolicy(APIPolicy $policy, APIPolicyUpdateStruct $policyUpdateStruct)
455 {
456 $values = $this->requestParser->parse('role', $policy->roleId);
457 $inputMessage = $this->outputVisitor->visit($policyUpdateStruct);
458 $inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType('Policy');
459 $inputMessage->headers['X-HTTP-Method-Override'] = 'PATCH';
460
461 $result = $this->client->request(
462 'POST',
463 $this->requestParser->generate(
464 'policy',
465 array(
466 'role' => $values['role'],
467 'policy' => $policy->id,
468 )
469 ),
470 $inputMessage
471 );
472
473 return $this->inputDispatcher->parse($result);
474 }
475
486 public function loadRole($id)
487 {
488 $response = $this->client->request(
489 'GET',
490 $id,
491 new Message(
492 array('Accept' => $this->outputVisitor->getMediaType('Role'))
493 )
494 );
495
496 $loadedRole = $this->inputDispatcher->parse($response);
497 $loadedRoleValues = $this->requestParser->parse('role', $loadedRole->id);
498 $response = $this->client->request(
499 'GET',
500 $this->requestParser->generate('policies', array('role' => $loadedRoleValues['role'])),
501 new Message(
502 array('Accept' => $this->outputVisitor->getMediaType('PolicyList'))
503 )
504 );
505
506 $policies = $this->inputDispatcher->parse($response);
507
508 return new Role(
509 array(
510 'id' => $loadedRole->id,
511 'identifier' => $loadedRole->identifier,
512 ),
513 $policies
514 );
515 }
516
527 public function loadRoleByIdentifier($name)
528 {
529 $response = $this->client->request(
530 'GET',
531 $this->requestParser->generate('roleByIdentifier', array('role' => $name)),
532 new Message(
533 array('Accept' => $this->outputVisitor->getMediaType('RoleList'))
534 )
535 );
536
537 $result = $this->inputDispatcher->parse($response);
538
539 return reset($result);
540 }
541
547 public function loadRoles()
548 {
549 $response = $this->client->request(
550 'GET',
551 $this->requestParser->generate('roles'),
552 new Message(
553 array('Accept' => $this->outputVisitor->getMediaType('RoleList'))
554 )
555 );
556
557 return $this->inputDispatcher->parse($response);
558 }
559
567 public function deleteRole(APIRole $role)
568 {
569 $response = $this->client->request(
570 'DELETE',
571 $role->id,
572 new Message(
573 // @todo: What media-type should we set here? Actually, it should be
574 // all expected exceptions + none? Or is "Section" correct,
575 // since this is what is to be expected by the resource
576 // identified by the URL?
577 array('Accept' => $this->outputVisitor->getMediaType('Role'))
578 )
579 );
580
581 if (!empty($response->body)) {
582 $this->inputDispatcher->parse($response);
583 }
584 }
585
595 public function loadPoliciesByUserId($userId)
596 {
597 $values = $this->requestParser->parse('user', $userId);
598 $response = $this->client->request(
599 'GET',
600 $this->requestParser->generate('userPolicies', array('user' => $values['user'])),
601 new Message(
602 array('Accept' => $this->outputVisitor->getMediaType('PolicyList'))
603 )
604 );
605
606 return $this->inputDispatcher->parse($response);
607 }
608
619 public function assignRoleToUserGroup(APIRole $role, UserGroup $userGroup, RoleLimitation $roleLimitation = null)
620 {
621 $roleAssignment = new RoleAssignment(
622 array(
623 'role' => $role,
624 'limitation' => $roleLimitation,
625 )
626 );
627
628 $inputMessage = $this->outputVisitor->visit($roleAssignment);
629 $inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType('RoleAssignmentList');
630
631 $result = $this->client->request(
632 'POST',
633 $this->requestParser->generate('groupRoleAssignments', array('group' => $userGroup->id)),
634 $inputMessage
635 );
636
637 $this->inputDispatcher->parse($result);
638 }
639
649 public function unassignRoleFromUserGroup(APIRole $role, UserGroup $userGroup)
650 {
651 $values = $this->requestParser->parse('group', $userGroup->id);
652 $userGroupId = $values['group'];
653
654 $values = $this->requestParser->parse('role', $role->id);
655 $roleId = $values['role'];
656
657 $response = $this->client->request(
658 'DELETE',
659 $this->requestParser->generate('groupRoleAssignment', array('group' => $userGroupId, 'role' => $roleId)),
660 new Message(
661 // @todo: What media-type should we set here? Actually, it should be
662 // all expected exceptions + none? Or is "Section" correct,
663 // since this is what is to be expected by the resource
664 // identified by the URL?
665 array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList'))
666 )
667 );
668
669 if (!empty($response->body)) {
670 $this->inputDispatcher->parse($response);
671 }
672 }
673
686 public function assignRoleToUser(APIRole $role, User $user, RoleLimitation $roleLimitation = null)
687 {
688 $roleAssignment = new RoleAssignment(
689 array(
690 'role' => $role,
691 'limitation' => $roleLimitation,
692 )
693 );
694
695 $inputMessage = $this->outputVisitor->visit($roleAssignment);
696 $inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType('RoleAssignmentList');
697
698 $result = $this->client->request(
699 'POST',
700 $this->requestParser->generate('userRoleAssignments', array('user' => $user->id)),
701 $inputMessage
702 );
703
704 $this->inputDispatcher->parse($result);
705 }
706
716 public function unassignRoleFromUser(APIRole $role, User $user)
717 {
718 $values = $this->requestParser->parse('user', $user->id);
719 $userId = $values['user'];
720
721 $values = $this->requestParser->parse('role', $role->id);
722 $roleId = $values['role'];
723
724 $response = $this->client->request(
725 'DELETE',
726 $this->requestParser->generate('userRoleAssignment', array('user' => $userId, 'role' => $roleId)),
727 new Message(
728 // @todo: What media-type should we set here? Actually, it should be
729 // all expected exceptions + none? Or is "Section" correct,
730 // since this is what is to be expected by the resource
731 // identified by the URL?
732 array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList'))
733 )
734 );
735
736 if (!empty($response->body)) {
737 $this->inputDispatcher->parse($response);
738 }
739 }
740
748 public function removeRoleAssignment(APIRoleAssignment $roleAssignment)
749 {
750 throw new \Exception('@todo: Implement.');
751 }
752
763 public function loadRoleAssignment($roleAssignmentId)
764 {
765 throw new \Exception('@todo: Implement.');
766 }
767
777 public function getRoleAssignments(APIRole $role)
778 {
779 throw new \Exception('@todo: Implement.');
780 }
781
785 public function getRoleAssignmentsForUser(User $user, $inherited = false)
786 {
787 $response = $this->client->request(
788 'GET',
789 $this->requestParser->generate('userRoleAssignments'),
790 new Message(
791 array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList'))
792 )
793 );
794
795 $roleAssignments = $this->inputDispatcher->parse($response);
796
797 $userRoleAssignments = array();
798 foreach ($roleAssignments as $roleAssignment) {
799 $userRoleAssignments[] = new UserRoleAssignment(
800 array(
801 'limitation' => $roleAssignment->getRoleLimitation(),
802 'role' => $roleAssignment->getRole(),
803 'user' => $user,
804 )
805 );
806 }
807
808 return $userRoleAssignments;
809 }
810
818 public function getRoleAssignmentsForUserGroup(UserGroup $userGroup)
819 {
820 $response = $this->client->request(
821 'GET',
822 $this->requestParser->generate('groupRoleAssignments'),
823 new Message(
824 array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList'))
825 )
826 );
827
828 $roleAssignments = $this->inputDispatcher->parse($response);
829
830 $userGroupRoleAssignments = array();
831 foreach ($roleAssignments as $roleAssignment) {
832 $userGroupRoleAssignments[] = new UserGroupRoleAssignment(
833 array(
834 'limitation' => $roleAssignment->getRoleLimitation(),
835 'role' => $roleAssignment->getRole(),
836 'userGroup' => $userGroup,
837 )
838 );
839 }
840
841 return $userGroupRoleAssignments;
842 }
843
851 public function newRoleCreateStruct($name)
852 {
853 return new Values\User\RoleCreateStruct($name);
854 }
855
864 public function newPolicyCreateStruct($module, $function)
865 {
866 return new PolicyCreateStruct($module, $function);
867 }
868
874 public function newPolicyUpdateStruct()
875 {
876 return new PolicyUpdateStruct();
877 }
878
884 public function newRoleUpdateStruct()
885 {
886 return new RoleUpdateStruct();
887 }
888
898 public function getLimitationType($identifier)
899 {
900 throw new \eZ\Publish\API\Repository\Exceptions\NotImplementedException(__METHOD__);
901 }
902
918 public function getLimitationTypesByModuleFunction($module, $function)
919 {
920 throw new \eZ\Publish\API\Repository\Exceptions\NotImplementedException(__METHOD__);
921 }
922 }
eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation
Definition: eZ/Publish/API/Repository/Values/User/Limitation/RoleLimitation.php:12
eZ\Publish\API\Repository\Values\User\PolicyCreateStruct
This class is used to create a policy.
Definition: API/Repository/Values/User/PolicyCreateStruct.php:13
eZ\Publish\API\Repository\Values\User\PolicyDraft
Definition: API/Repository/Values/User/PolicyDraft.php:13
eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct
This class is used for updating a policy.
Definition: API/Repository/Values/User/PolicyUpdateStruct.php:14
eZ\Publish\API\Repository\Values\User\Policy
Definition: API/Repository/Values/User/Policy.php:21
eZ\Publish\API\Repository\Values\User\RoleAssignment
Definition: API/Repository/Values/User/RoleAssignment.php:18
eZ\Publish\API\Repository\Values\User\RoleCreateStruct
This class is used to create a new role.
Definition: API/Repository/Values/User/RoleCreateStruct.php:15
eZ\Publish\API\Repository\Values\User\RoleDraft
This class represents a draft of a role.
Definition: API/Repository/Values/User/RoleDraft.php:13
eZ\Publish\API\Repository\Values\User\RoleUpdateStruct
This class is used to update a role.
Definition: API/Repository/Values/User/RoleUpdateStruct.php:15
eZ\Publish\API\Repository\Values\User\Role
Definition: API/Repository/Values/User/Role.php:19
eZ\Publish\API\Repository\Values\User\UserGroup
Definition: API/Repository/Values/User/UserGroup.php:17
eZ\Publish\API\Repository\Values\User\User
Definition: Publish/API/Repository/Values/User/User.php:24
eZ\Publish\Core\REST\Client\RoleService
Implementation of the \eZ\Publish\API\Repository\RoleService interface.
Definition: Core/REST/Client/RoleService.php:42
eZ\Publish\Core\REST\Client\RoleService\addPolicy
addPolicy(APIRole $role, APIPolicyCreateStruct $policyCreateStruct)
Adds a new policy to the role.
Definition: Core/REST/Client/RoleService.php:347
eZ\Publish\Core\REST\Client\RoleService\createRole
createRole(APIRoleCreateStruct $roleCreateStruct)
Creates a new Role draft.
Definition: Core/REST/Client/RoleService.php:256
eZ\Publish\Core\REST\Client\RoleService\getRoleAssignmentsForUserGroup
getRoleAssignmentsForUserGroup(UserGroup $userGroup)
Returns the roles assigned to the given user group, excluding the ones the current user is not allowe...
Definition: Core/REST/Client/RoleService.php:818
eZ\Publish\Core\REST\Client\RoleService\setSession
setSession($id)
Set session ID.
Definition: Core/REST/Client/RoleService.php:83
eZ\Publish\Core\REST\Client\RoleService\unassignRoleFromUserGroup
unassignRoleFromUserGroup(APIRole $role, UserGroup $userGroup)
removes a role from the given user group.
Definition: Core/REST/Client/RoleService.php:649
eZ\Publish\Core\REST\Client\RoleService\removePolicy
removePolicy(APIRole $role, APIPolicy $policy)
Removes a policy from the role.
Definition: Core/REST/Client/RoleService.php:396
eZ\Publish\Core\REST\Client\RoleService\getLimitationTypesByModuleFunction
getLimitationTypesByModuleFunction($module, $function)
Returns the LimitationType's assigned to a given module/function.
Definition: Core/REST/Client/RoleService.php:918
eZ\Publish\Core\REST\Client\RoleService\newPolicyCreateStruct
newPolicyCreateStruct($module, $function)
Instantiates a policy create class.
Definition: Core/REST/Client/RoleService.php:864
eZ\Publish\Core\REST\Client\RoleService\loadPoliciesByUserId
loadPoliciesByUserId($userId)
Loads all policies from roles which are assigned to a user or to user groups to which the user belong...
Definition: Core/REST/Client/RoleService.php:595
eZ\Publish\Core\REST\Client\RoleService\$client
$client
Definition: Core/REST/Client/RoleService.php:47
eZ\Publish\Core\REST\Client\RoleService\removeRoleAssignment
removeRoleAssignment(APIRoleAssignment $roleAssignment)
Removes the given role assignment.
Definition: Core/REST/Client/RoleService.php:748
eZ\Publish\Core\REST\Client\RoleService\removePolicyByRoleDraft
removePolicyByRoleDraft(APIRoleDraft $roleDraft, PolicyDraft $policyDraft)
Removes a policy from a role draft.
Definition: Core/REST/Client/RoleService.php:188
eZ\Publish\Core\REST\Client\RoleService\updateRole
updateRole(APIRole $role, RoleUpdateStruct $roleUpdateStruct)
Updates the name of the role.
Definition: Core/REST/Client/RoleService.php:317
eZ\Publish\Core\REST\Client\RoleService\deleteRole
deleteRole(APIRole $role)
Deletes the given role.
Definition: Core/REST/Client/RoleService.php:567
eZ\Publish\Core\REST\Client\RoleService\assignRoleToUserGroup
assignRoleToUserGroup(APIRole $role, UserGroup $userGroup, RoleLimitation $roleLimitation=null)
Assigns a role to the given user group.
Definition: Core/REST/Client/RoleService.php:619
eZ\Publish\Core\REST\Client\RoleService\createRoleDraft
createRoleDraft(APIRole $role)
Creates a new RoleDraft for existing Role.
Definition: Core/REST/Client/RoleService.php:103
eZ\Publish\Core\REST\Client\RoleService\$userService
$userService
Definition: Core/REST/Client/RoleService.php:44
eZ\Publish\Core\REST\Client\RoleService\updatePolicyByRoleDraft
updatePolicyByRoleDraft(APIRoleDraft $roleDraft, PolicyDraft $policy, APIPolicyUpdateStruct $policyUpdateStruct)
Updates the limitations of a policy.
Definition: Core/REST/Client/RoleService.php:210
eZ\Publish\Core\REST\Client\RoleService\updatePolicy
updatePolicy(APIPolicy $policy, APIPolicyUpdateStruct $policyUpdateStruct)
Updates the limitations of a policy.
Definition: Core/REST/Client/RoleService.php:454
eZ\Publish\Core\REST\Client\RoleService\publishRoleDraft
publishRoleDraft(APIRoleDraft $roleDraft)
Publishes a given Role draft.
Definition: Core/REST/Client/RoleService.php:238
eZ\Publish\Core\REST\Client\RoleService\loadRoleDraft
loadRoleDraft($id)
Loads a role for the given id.
Definition: Core/REST/Client/RoleService.php:120
eZ\Publish\Core\REST\Client\RoleService\deleteRoleDraft
deleteRoleDraft(APIRoleDraft $roleDraft)
Deletes the given role.
Definition: Core/REST/Client/RoleService.php:224
eZ\Publish\Core\REST\Client\RoleService\loadRoleByIdentifier
loadRoleByIdentifier($name)
Loads a role for the given name.
Definition: Core/REST/Client/RoleService.php:527
eZ\Publish\Core\REST\Client\RoleService\$requestParser
$requestParser
Definition: Core/REST/Client/RoleService.php:56
eZ\Publish\Core\REST\Client\RoleService\getRoleAssignments
getRoleAssignments(APIRole $role)
Returns the assigned user and user groups to this role.
Definition: Core/REST/Client/RoleService.php:777
eZ\Publish\Core\REST\Client\RoleService\updateRoleDraft
updateRoleDraft(APIRoleDraft $roleDraft, RoleUpdateStruct $roleUpdateStruct)
Updates the properties of a role draft.
Definition: Core/REST/Client/RoleService.php:153
eZ\Publish\Core\REST\Client\RoleService\getLimitationType
getLimitationType($identifier)
Returns the LimitationType registered with the given identifier.
Definition: Core/REST/Client/RoleService.php:898
eZ\Publish\Core\REST\Client\RoleService\getRoleAssignmentsForUser
getRoleAssignmentsForUser(User $user, $inherited=false)
Definition: Core/REST/Client/RoleService.php:785
eZ\Publish\Core\REST\Client\RoleService\newPolicyUpdateStruct
newPolicyUpdateStruct()
Instantiates a policy update class.
Definition: Core/REST/Client/RoleService.php:874
eZ\Publish\Core\REST\Client\RoleService\$inputDispatcher
$inputDispatcher
Definition: Core/REST/Client/RoleService.php:50
eZ\Publish\Core\REST\Client\RoleService\addPolicyByRoleDraft
addPolicyByRoleDraft(APIRoleDraft $roleDraft, APIPolicyCreateStruct $policyCreateStruct)
Adds a new policy to the role draft.
Definition: Core/REST/Client/RoleService.php:173
eZ\Publish\Core\REST\Client\RoleService\$outputVisitor
$outputVisitor
Definition: Core/REST/Client/RoleService.php:53
eZ\Publish\Core\REST\Client\RoleService\loadRole
loadRole($id)
Loads a role for the given id.
Definition: Core/REST/Client/RoleService.php:486
eZ\Publish\Core\REST\Client\RoleService\assignRoleToUser
assignRoleToUser(APIRole $role, User $user, RoleLimitation $roleLimitation=null)
Assigns a role to the given user.
Definition: Core/REST/Client/RoleService.php:686
eZ\Publish\Core\REST\Client\RoleService\unassignRoleFromUser
unassignRoleFromUser(APIRole $role, User $user)
removes a role from the given user.
Definition: Core/REST/Client/RoleService.php:716
eZ\Publish\Core\REST\Client\RoleService\loadRoles
loadRoles()
Loads all roles, excluding the ones the current user is not allowed to read.
Definition: Core/REST/Client/RoleService.php:547
eZ\Publish\Core\REST\Client\RoleService\deletePolicy
deletePolicy(APIPolicy $policy)
Deletes a policy.
Definition: Core/REST/Client/RoleService.php:433
eZ\Publish\Core\REST\Client\RoleService\__construct
__construct(UserService $userService, HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, RequestParser $requestParser)
Definition: Core/REST/Client/RoleService.php:65
eZ\Publish\Core\REST\Client\RoleService\newRoleUpdateStruct
newRoleUpdateStruct()
Instantiates a policy update class.
Definition: Core/REST/Client/RoleService.php:884
eZ\Publish\Core\REST\Client\RoleService\newRoleCreateStruct
newRoleCreateStruct($name)
Instantiates a role create class.
Definition: Core/REST/Client/RoleService.php:851
eZ\Publish\Core\REST\Client\RoleService\loadRoleAssignment
loadRoleAssignment($roleAssignmentId)
Loads a user assignment for the given id.
Definition: Core/REST/Client/RoleService.php:763
eZ\Publish\Core\REST\Client\RoleService\loadRoleDraftByRoleId
loadRoleDraftByRoleId($roleId)
Loads a RoleDraft by the ID of the role it was created from.
Definition: Core/REST/Client/RoleService.php:135
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\Values\User\PolicyCreateStruct
Implementation of the \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct class.
Definition: Core/REST/Client/Values/User/PolicyCreateStruct.php:19
eZ\Publish\Core\REST\Client\Values\User\PolicyUpdateStruct
Implementation of the \eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct class.
Definition: Core/REST/Client/Values/User/PolicyUpdateStruct.php:19
eZ\Publish\Core\REST\Client\Values\User\Policy
Implementation of the \eZ\Publish\API\Repository\Values\User\Policy class.
Definition: Core/REST/Client/Values/User/Policy.php:18
eZ\Publish\Core\REST\Client\Values\User\RoleAssignment
Implementation of the \eZ\Publish\API\Repository\Values\User\RoleAssignment class.
Definition: Core/REST/Client/Values/User/RoleAssignment.php:18
eZ\Publish\Core\REST\Client\Values\User\RoleCreateStruct
Implementation of the \eZ\Publish\API\Repository\Values\User\RoleCreateStruct class.
Definition: Core/REST/Client/Values/User/RoleCreateStruct.php:19
eZ\Publish\Core\REST\Client\Values\User\Role
Implementation of the \eZ\Publish\API\Repository\Values\User\Role class.
Definition: Core/REST/Client/Values/User/Role.php:18
eZ\Publish\Core\REST\Common\Input\Dispatcher
Input dispatcher.
Definition: Dispatcher.php:16
eZ\Publish\Core\REST\Common\Message
Simple response struct.
Definition: Core/REST/Common/Message.php:13
eZ\Publish\Core\REST\Common\Output\Visitor
Visits a value object into an HTTP Response.
Definition: Visitor.php:15
eZ\Publish\Core\Repository\Values\User\RoleDraft
This class represents a draft of a role.
Definition: Core/Repository/Values/User/RoleDraft.php:17
eZ\Publish\Core\Repository\Values\User\UserGroupRoleAssignment
This class represents a user group to role assignment.
Definition: Core/Repository/Values/User/UserGroupRoleAssignment.php:17
eZ\Publish\Core\Repository\Values\User\UserRoleAssignment
This class represents a user to role assignment.
Definition: Core/Repository/Values/User/UserRoleAssignment.php:17
eZ\Publish\API\Repository\RoleService
This service provides methods for managing Roles and Policies.
Definition: API/Repository/RoleService.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+.