Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
AclListQueryTrait.php
Go to the documentation of this file.
1<?php
3
6
13
14 abstract public function getRoleByName(string $name);
15
16 abstract public function getResourceByName(string $name);
17
18 abstract public function getPermissionByName(string $name);
19
20 abstract public function getProvider(string $providerClass);
21
22 public function getAclsWithRole(string $role) {
23 $result = [];
24 foreach ($this->acls as $acl) {
25 if ($acl->getRole()->getName() === $role) {
26 $result[] = $acl;
27 }
28 }
29 return $result;
30 }
31
32 public function getAclsWithResource(string $resource) {
33 $result = [];
34 foreach ($this->acls as $acl) {
35 if ($acl->getResource()->getName() === $resource) {
36 $result[] = $acl;
37 }
38 }
39 return $result;
40 }
41
42 public function getAclsWithPermission(string $permission) {
43 $result = [];
44 foreach ($this->acls as $acl) {
45 if ($acl->getPermission()->getName() === $permission) {
46 $result[] = $acl;
47 }
48 }
49 return $result;
50 }
51
52 public function getRolesWithPermissionOnResource(string $resource, string $permission) {
53 $result = [];
54 foreach ($this->acls as $acl) {
55 if ($acl->getPermission()->getName() === $permission && $acl->getResource()->getName() === $resource) {
56 $result[] = $acl->getRole()->getName();
57 }
58 }
59 return $result;
60 }
61
68 public function existPartIn(AbstractAclPart $part, string $providerClass) {
69 $prov = $this->getProvider($providerClass);
70 if (isset($prov)) {
71 return $prov->existPart($part);
72 }
73 return false;
74 }
75
82 public function existAclIn(AclElement $elm, string $providerClass) {
83 $prov = $this->getProvider($providerClass);
84 if (isset($prov)) {
85 return $prov->existAcl($elm);
86 }
87 return false;
88 }
89}
90
Ubiquity\security\acl\models$AbastractAclElement This class is part of Ubiquity.
Ubiquity\security\acl\models$AclElement This class is part of Ubiquity.
getRolesWithPermissionOnResource(string $resource, string $permission)
existAclIn(AclElement $elm, string $providerClass)
existPartIn(AbstractAclPart $part, string $providerClass)