1 | <?php |
||
2 | |||
3 | namespace Jabe\Impl; |
||
4 | |||
5 | use Jabe\AuthorizationServiceInterface; |
||
6 | use Jabe\Authorization\{ |
||
7 | AuthorizationInterface, |
||
8 | AuthorizationQueryInterface, |
||
9 | PermissionInterface, |
||
10 | ResourceInterface |
||
11 | }; |
||
12 | use Jabe\Impl\Cmd\{ |
||
13 | AuthorizationCheckCmd, |
||
14 | CreateAuthorizationCommand, |
||
15 | DeleteAuthorizationCmd, |
||
16 | SaveAuthorizationCmd |
||
17 | }; |
||
18 | |||
19 | class AuthorizationServiceImpl extends ServiceImpl implements AuthorizationServiceInterface |
||
20 | { |
||
21 | public function createAuthorizationQuery(): AuthorizationQueryInterface |
||
22 | { |
||
23 | return new AuthorizationQueryImpl($this->commandExecutor); |
||
24 | } |
||
25 | |||
26 | public function createNewAuthorization(int $type): AuthorizationInterface |
||
27 | { |
||
28 | return $this->commandExecutor->execute(new CreateAuthorizationCommand($type)); |
||
29 | } |
||
30 | |||
31 | public function saveAuthorization(AuthorizationInterface $authorization): AuthorizationInterface |
||
32 | { |
||
33 | return $this->commandExecutor->execute(new SaveAuthorizationCmd($authorization)); |
||
34 | } |
||
35 | |||
36 | public function deleteAuthorization(string $authorizationId): void |
||
37 | { |
||
38 | $this->commandExecutor->execute(new DeleteAuthorizationCmd($authorizationId)); |
||
39 | } |
||
40 | |||
41 | public function isUserAuthorized(string $userId, array $groupIds, PermissionInterface $permission, ResourceInterface $resource, string $resourceId = null): bool |
||
42 | { |
||
43 | return $this->commandExecutor->execute(new AuthorizationCheckCmd($userId, $groupIds, $permission, $resource, $resourceId)); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
44 | } |
||
45 | } |
||
46 |