| @@ 185-202 (lines=18) @@ | ||
| 182 | * |
|
| 183 | * @return \eZ\Publish\SPI\Persistence\User\RoleCreateStruct |
|
| 184 | */ |
|
| 185 | public function buildPersistenceRoleCreateStruct(APIRoleCreateStruct $roleCreateStruct) |
|
| 186 | { |
|
| 187 | $policiesToCreate = []; |
|
| 188 | foreach ($roleCreateStruct->getPolicies() as $policyCreateStruct) { |
|
| 189 | $policiesToCreate[] = $this->buildPersistencePolicyObject( |
|
| 190 | $policyCreateStruct->module, |
|
| 191 | $policyCreateStruct->function, |
|
| 192 | $policyCreateStruct->getLimitations() |
|
| 193 | ); |
|
| 194 | } |
|
| 195 | ||
| 196 | return new SPIRoleCreateStruct( |
|
| 197 | [ |
|
| 198 | 'identifier' => $roleCreateStruct->identifier, |
|
| 199 | 'policies' => $policiesToCreate, |
|
| 200 | ] |
|
| 201 | ); |
|
| 202 | } |
|
| 203 | ||
| 204 | /** |
|
| 205 | * Creates SPI Role copy struct from provided API role copy struct. |
|
| @@ 207-225 (lines=19) @@ | ||
| 204 | /** |
|
| 205 | * Creates SPI Role copy struct from provided API role copy struct. |
|
| 206 | */ |
|
| 207 | public function buildPersistenceRoleCopyStruct(APIRoleCopyStruct $roleCopyStruct, int $clonedId): SPIRoleCopyStruct |
|
| 208 | { |
|
| 209 | $policiesToCopy = []; |
|
| 210 | foreach ($roleCopyStruct->getPolicies() as $policyCopyStruct) { |
|
| 211 | $policiesToCopy[] = $this->buildPersistencePolicyObject( |
|
| 212 | $policyCopyStruct->module, |
|
| 213 | $policyCopyStruct->function, |
|
| 214 | $policyCopyStruct->getLimitations() |
|
| 215 | ); |
|
| 216 | } |
|
| 217 | ||
| 218 | return new SPIRoleCopyStruct( |
|
| 219 | [ |
|
| 220 | 'clonedId' => $clonedId, |
|
| 221 | 'newIdentifier' => $roleCopyStruct->newIdentifier, |
|
| 222 | 'policies' => $policiesToCopy, |
|
| 223 | ] |
|
| 224 | ); |
|
| 225 | } |
|
| 226 | ||
| 227 | /** |
|
| 228 | * Creates SPI Policy value object from provided module, function and limitations. |
|