@@ 65-77 (lines=13) @@ | ||
62 | * @return bool |
|
63 | * function that allow to test a right directly in the view |
|
64 | */ |
|
65 | public function testRight(string $right): bool |
|
66 | { |
|
67 | $user_rights = $this->getUserRights(); |
|
68 | $list_rights = $this->getRightsListOfUser(); |
|
69 | ||
70 | $all_rights = array_merge($user_rights, $list_rights); |
|
71 | ||
72 | if (in_array($right, $all_rights)) { |
|
73 | return true; |
|
74 | } |
|
75 | ||
76 | return false; |
|
77 | } |
|
78 | ||
79 | /** |
|
80 | * @param array $route_right |
|
@@ 84-97 (lines=14) @@ | ||
81 | * @return bool |
|
82 | * test if route_right is found in users rights |
|
83 | */ |
|
84 | private function testRouteRight(array $route_right): bool { |
|
85 | $user_rights = $this->getUserRights(); |
|
86 | $list_rights = $this->getRightsListOfUser(); |
|
87 | ||
88 | $all_rights = array_merge($user_rights, $list_rights); |
|
89 | ||
90 | foreach ($all_rights as $right) { |
|
91 | if (in_array($right, $route_right)) { |
|
92 | return true; |
|
93 | } |
|
94 | } |
|
95 | ||
96 | return false; |
|
97 | } |
|
98 | ||
99 | /** |
|
100 | * @param $needle |