@@ 76-99 (lines=24) @@ | ||
73 | * |
|
74 | * @return bool |
|
75 | */ |
|
76 | public function checkRight($userId, $right) |
|
77 | { |
|
78 | $user = new CurrentUser($this->config); |
|
79 | $user->getUserById($userId); |
|
80 | ||
81 | if ($user->isSuperAdmin()) { |
|
82 | return true; |
|
83 | } |
|
84 | ||
85 | // get right id |
|
86 | if (!is_numeric($right) && is_string($right)) { |
|
87 | $right = $this->getRightId($right); |
|
88 | } |
|
89 | ||
90 | // check user right, group right and section right |
|
91 | if ( |
|
92 | $this->checkUserSectionRight($userId, $right) || |
|
93 | $this->checkUserGroupRight($userId, $right) || |
|
94 | $this->checkUserRight($userId, $right) |
|
95 | ) { |
|
96 | return true; |
|
97 | } |
|
98 | return false; |
|
99 | } |
|
100 | ||
101 | /** |
|
102 | * Returns true if the user $userId owns the right $rightId |
@@ 159-182 (lines=24) @@ | ||
156 | * |
|
157 | * @return bool |
|
158 | */ |
|
159 | public function checkRight($userId, $right) |
|
160 | { |
|
161 | $user = new CurrentUser($this->config); |
|
162 | $user->getUserById($userId); |
|
163 | ||
164 | if ($user->isSuperAdmin()) { |
|
165 | return true; |
|
166 | } |
|
167 | ||
168 | // get right id |
|
169 | if (!is_numeric($right) && is_string($right)) { |
|
170 | $right = $this->getRightId($right); |
|
171 | } |
|
172 | ||
173 | // check user right and group right |
|
174 | if ( |
|
175 | $this->checkUserGroupRight($userId, $right) || |
|
176 | $this->checkUserRight($userId, $right) |
|
177 | ) { |
|
178 | return true; |
|
179 | } |
|
180 | ||
181 | return false; |
|
182 | } |
|
183 | ||
184 | /** |
|
185 | * Grants the group given by $groupId the right specified by |