Completed
Push — siteaccessaware-layer-only ( 7e91dd...edaec2 )
by André
56:17 queued 37:14
created

RoleService::addPolicy()   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 2
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
    /** @var \eZ\Publish\API\Repository\RoleService */
33
    protected $service;
34
35
    /**
36
     * Construct service object from aggregated service.
37
     *
38
     * @param \eZ\Publish\API\Repository\RoleService $service
39
     */
40
    public function __construct(
41
        RoleServiceInterface $service
42
    ) {
43
        $this->service = $service;
44
    }
45
46
    public function createRole(RoleCreateStruct $roleCreateStruct)
47
    {
48
        return $this->service->createRole($roleCreateStruct);
49
    }
50
51
    public function createRoleDraft(Role $role)
52
    {
53
        return $this->service->createRoleDraft($role);
54
    }
55
56
    public function loadRoleDraft($id)
57
    {
58
        return $this->service->loadRoleDraft($id);
59
    }
60
61
    public function loadRoleDraftByRoleId($roleId)
62
    {
63
        return $this->service->loadRoleDraftByRoleId($roleId);
64
    }
65
66
    public function updateRoleDraft(RoleDraft $roleDraft, RoleUpdateStruct $roleUpdateStruct)
67
    {
68
        return $this->service->updateRoleDraft($roleDraft, $roleUpdateStruct);
69
    }
70
71
    public function addPolicyByRoleDraft(RoleDraft $roleDraft, PolicyCreateStruct $policyCreateStruct)
72
    {
73
        return $this->service->addPolicyByRoleDraft($roleDraft, $policyCreateStruct);
74
    }
75
76
    public function removePolicyByRoleDraft(RoleDraft $roleDraft, PolicyDraft $policyDraft)
77
    {
78
        return $this->service->removePolicyByRoleDraft($roleDraft, $policyDraft);
79
    }
80
81
    public function updatePolicyByRoleDraft(RoleDraft $roleDraft, PolicyDraft $policy, PolicyUpdateStruct $policyUpdateStruct)
82
    {
83
        return $this->service->updatePolicyByRoleDraft($roleDraft, $policy, $policyUpdateStruct);
84
    }
85
86
    public function deleteRoleDraft(RoleDraft $roleDraft)
87
    {
88
        return $this->service->deleteRoleDraft($roleDraft);
89
    }
90
91
    public function publishRoleDraft(RoleDraft $roleDraft)
92
    {
93
        return $this->service->publishRoleDraft($roleDraft);
94
    }
95
96
    public function updateRole(Role $role, RoleUpdateStruct $roleUpdateStruct)
97
    {
98
        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...
99
    }
100
101
    public function addPolicy(Role $role, PolicyCreateStruct $policyCreateStruct)
102
    {
103
        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...
104
    }
105
106
    public function deletePolicy(Policy $policy)
107
    {
108
        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...
109
    }
110
111
    public function updatePolicy(Policy $policy, PolicyUpdateStruct $policyUpdateStruct)
112
    {
113
        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...
114
    }
115
116
    public function loadRole($id)
117
    {
118
        return $this->service->loadRole($id);
119
    }
120
121
    public function loadRoleByIdentifier($identifier)
122
    {
123
        return $this->service->loadRoleByIdentifier($identifier);
124
    }
125
126
    public function loadRoles()
127
    {
128
        return $this->service->loadRoles();
129
    }
130
131
    public function deleteRole(Role $role)
132
    {
133
        return $this->service->deleteRole($role);
134
    }
135
136
    public function loadPoliciesByUserId($userId)
137
    {
138
        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...
139
    }
140
141
    public function assignRoleToUserGroup(Role $role, UserGroup $userGroup, RoleLimitation $roleLimitation = null)
142
    {
143
        return $this->service->assignRoleToUserGroup($role, $userGroup, $roleLimitation);
144
    }
145
146
    public function unassignRoleFromUserGroup(Role $role, UserGroup $userGroup)
147
    {
148
        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...
149
    }
150
151
    public function assignRoleToUser(Role $role, User $user, RoleLimitation $roleLimitation = null)
152
    {
153
        return $this->service->assignRoleToUser($role, $user, $roleLimitation);
154
    }
155
156
    public function unassignRoleFromUser(Role $role, User $user)
157
    {
158
        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...
159
    }
160
161
    public function removeRoleAssignment(RoleAssignment $roleAssignment)
162
    {
163
        return $this->service->removeRoleAssignment($roleAssignment);
164
    }
165
166
    public function loadRoleAssignment($roleAssignmentId)
167
    {
168
        return $this->service->loadRoleAssignment($roleAssignmentId);
169
    }
170
171
    public function getRoleAssignments(Role $role)
172
    {
173
        return $this->service->getRoleAssignments($role);
174
    }
175
176
    public function getRoleAssignmentsForUser(User $user, $inherited = false)
177
    {
178
        return $this->service->getRoleAssignmentsForUser($user, $inherited);
179
    }
180
181
    public function getRoleAssignmentsForUserGroup(UserGroup $userGroup)
182
    {
183
        return $this->service->getRoleAssignmentsForUserGroup($userGroup);
184
    }
185
186
    public function newRoleCreateStruct($name)
187
    {
188
        return $this->service->newRoleCreateStruct($name);
189
    }
190
191
    public function newPolicyCreateStruct($module, $function)
192
    {
193
        return $this->service->newPolicyCreateStruct($module, $function);
194
    }
195
196
    public function newPolicyUpdateStruct()
197
    {
198
        return $this->service->newPolicyUpdateStruct();
199
    }
200
201
    public function newRoleUpdateStruct()
202
    {
203
        return $this->service->newRoleUpdateStruct();
204
    }
205
206
    public function getLimitationType($identifier)
207
    {
208
        return $this->service->getLimitationType($identifier);
209
    }
210
211
    public function getLimitationTypesByModuleFunction($module, $function)
212
    {
213
        return $this->service->getLimitationTypesByModuleFunction($module, $function);
214
    }
215
}
216