Completed
Push — siteaccessaware-layer-only ( 14ffb6 )
by André
15:43
created

RoleService::assignRoleToUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * RoleService class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\Repository\SiteAccessAware;
10
11
use eZ\Publish\API\Repository\RoleService as RoleServiceInterface;
12
use eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation;
13
use eZ\Publish\API\Repository\Values\User\Policy;
14
use eZ\Publish\API\Repository\Values\User\PolicyCreateStruct;
15
use eZ\Publish\API\Repository\Values\User\PolicyDraft;
16
use eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct;
17
use eZ\Publish\API\Repository\Values\User\Role;
18
use eZ\Publish\API\Repository\Values\User\RoleAssignment;
19
use eZ\Publish\API\Repository\Values\User\RoleCreateStruct;
20
use eZ\Publish\API\Repository\Values\User\RoleDraft;
21
use eZ\Publish\API\Repository\Values\User\RoleUpdateStruct;
22
use eZ\Publish\API\Repository\Values\User\User;
23
use eZ\Publish\API\Repository\Values\User\UserGroup;
24
25
/**
26
 * RoleService for SiteAccessAware layer.
27
 *
28
 * Currently does nothing but hand over calls to aggregated service.
29
 */
30
class RoleService implements RoleServiceInterface
31
{
32
    /**
33
     * Aggregated service.
34
     *
35
     * @var \eZ\Publish\API\Repository\RoleService
36
     */
37
    protected $service;
38
39
    /**
40
     * Construct service object from aggregated service.
41
     *
42
     * @param \eZ\Publish\API\Repository\RoleService $service
43
     */
44
    public function __construct(
45
        RoleServiceInterface $service
46
    ) {
47
        $this->service = $service;
48
    }
49
50
    public function createRole(RoleCreateStruct $roleCreateStruct)
51
    {
52
        return $this->service->createRole($roleCreateStruct);
53
    }
54
55
    public function createRoleDraft(Role $role)
56
    {
57
        return $this->service->createRoleDraft($role);
58
    }
59
60
    public function loadRoleDraft($id)
61
    {
62
        return $this->service->loadRoleDraft($id);
63
    }
64
65
    public function loadRoleDraftByRoleId($roleId)
66
    {
67
        return $this->service->loadRoleDraftByRoleId($roleId);
68
    }
69
70
    public function updateRoleDraft(RoleDraft $roleDraft, RoleUpdateStruct $roleUpdateStruct)
71
    {
72
        return $this->service->updateRoleDraft($roleDraft, $roleUpdateStruct);
73
    }
74
75
    public function addPolicyByRoleDraft(RoleDraft $roleDraft, PolicyCreateStruct $policyCreateStruct)
76
    {
77
        return $this->service->addPolicyByRoleDraft($roleDraft, $policyCreateStruct);
78
    }
79
80
    public function removePolicyByRoleDraft(RoleDraft $roleDraft, PolicyDraft $policyDraft)
81
    {
82
        return $this->service->removePolicyByRoleDraft($roleDraft, $policyDraft);
83
    }
84
85
    public function updatePolicyByRoleDraft(RoleDraft $roleDraft, PolicyDraft $policy, PolicyUpdateStruct $policyUpdateStruct)
86
    {
87
        return $this->service->updatePolicyByRoleDraft($roleDraft, $policy, $policyUpdateStruct);
88
    }
89
90
    public function deleteRoleDraft(RoleDraft $roleDraft)
91
    {
92
        return $this->service->deleteRoleDraft($roleDraft);
93
    }
94
95
    public function publishRoleDraft(RoleDraft $roleDraft)
96
    {
97
        return $this->service->publishRoleDraft($roleDraft);
98
    }
99
100
    public function updateRole(Role $role, RoleUpdateStruct $roleUpdateStruct)
101
    {
102
        return $this->service->updateRole($role, $roleUpdateStruct);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...leService::updateRole() has been deprecated with message: since 6.0, use {@see updateRoleDraft}

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
103
    }
104
105
    public function addPolicy(Role $role, PolicyCreateStruct $policyCreateStruct)
106
    {
107
        return $this->service->addPolicy($role, $policyCreateStruct);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repository\RoleService::addPolicy() has been deprecated with message: since 6.0, use {@see addPolicyByRoleDraft}

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
108
    }
109
110
    public function removePolicy(Role $role, Policy $policy)
111
    {
112
        return $this->service->removePolicy($role, $policy);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...Service::removePolicy() has been deprecated with message: since 5.3, use {@link removePolicyByRoleDraft()} instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
113
    }
114
115
    public function deletePolicy(Policy $policy)
116
    {
117
        return $this->service->deletePolicy($policy);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...Service::deletePolicy() has been deprecated with message: since 6.0, use {@link removePolicyByRoleDraft()} instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
118
    }
119
120
    public function updatePolicy(Policy $policy, PolicyUpdateStruct $policyUpdateStruct)
121
    {
122
        return $this->service->updatePolicy($policy, $policyUpdateStruct);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...Service::updatePolicy() has been deprecated with message: since 6.0, use {@link updatePolicyByRoleDraft()} instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
123
    }
124
125
    public function loadRole($id)
126
    {
127
        return $this->service->loadRole($id);
128
    }
129
130
    public function loadRoleByIdentifier($identifier)
131
    {
132
        return $this->service->loadRoleByIdentifier($identifier);
133
    }
134
135
    public function loadRoles()
136
    {
137
        return $this->service->loadRoles();
138
    }
139
140
    public function deleteRole(Role $role)
141
    {
142
        return $this->service->deleteRole($role);
143
    }
144
145
    public function loadPoliciesByUserId($userId)
146
    {
147
        return $this->service->loadPoliciesByUserId($userId);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...:loadPoliciesByUserId() has been deprecated with message: Since 6.8, not currently in use as permission system needs to know about role assignment limitations.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
148
    }
149
150
    public function assignRoleToUserGroup(Role $role, UserGroup $userGroup, RoleLimitation $roleLimitation = null)
151
    {
152
        return $this->service->assignRoleToUserGroup($role, $userGroup, $roleLimitation);
153
    }
154
155
    public function unassignRoleFromUserGroup(Role $role, UserGroup $userGroup)
156
    {
157
        return $this->service->unassignRoleFromUserGroup($role, $userGroup);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...signRoleFromUserGroup() has been deprecated with message: since 6.0, use {@see removeRoleAssignment} instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
158
    }
159
160
    public function assignRoleToUser(Role $role, User $user, RoleLimitation $roleLimitation = null)
161
    {
162
        return $this->service->assignRoleToUser($role, $user, $roleLimitation);
163
    }
164
165
    public function unassignRoleFromUser(Role $role, User $user)
166
    {
167
        return $this->service->unassignRoleFromUser($role, $user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...:unassignRoleFromUser() has been deprecated with message: since 6.0, use {@see removeRoleAssignment} instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
168
    }
169
170
    public function removeRoleAssignment(RoleAssignment $roleAssignment)
171
    {
172
        return $this->service->removeRoleAssignment($roleAssignment);
173
    }
174
175
    public function loadRoleAssignment($roleAssignmentId)
176
    {
177
        return $this->service->loadRoleAssignment($roleAssignmentId);
178
    }
179
180
    public function getRoleAssignments(Role $role)
181
    {
182
        return $this->service->getRoleAssignments($role);
183
    }
184
185
    public function getRoleAssignmentsForUser(User $user, $inherited = false)
186
    {
187
        return $this->service->getRoleAssignmentsForUser($user, $inherited);
188
    }
189
190
    public function getRoleAssignmentsForUserGroup(UserGroup $userGroup)
191
    {
192
        return $this->service->getRoleAssignmentsForUserGroup($userGroup);
193
    }
194
195
    public function newRoleCreateStruct($name)
196
    {
197
        return $this->service->newRoleCreateStruct($name);
198
    }
199
200
    public function newPolicyCreateStruct($module, $function)
201
    {
202
        return $this->service->newPolicyCreateStruct($module, $function);
203
    }
204
205
    public function newPolicyUpdateStruct()
206
    {
207
        return $this->service->newPolicyUpdateStruct();
208
    }
209
210
    public function newRoleUpdateStruct()
211
    {
212
        return $this->service->newRoleUpdateStruct();
213
    }
214
215
    public function getLimitationType($identifier)
216
    {
217
        return $this->service->getLimitationType($identifier);
218
    }
219
220
    public function getLimitationTypesByModuleFunction($module, $function)
221
    {
222
        return $this->service->getLimitationTypesByModuleFunction($module, $function);
223
    }
224
}
225