| @@ 183-198 (lines=16) @@ | ||
| 180 | return $this->getUser()->can($perm); |
|
| 181 | } |
|
| 182 | ||
| 183 | public function canLoginAs(User $user) |
|
| 184 | { |
|
| 185 | if (!$this->can('user.loginas')) { |
|
| 186 | return false; |
|
| 187 | } |
|
| 188 | ||
| 189 | if ($this->getSession()->has('loginas.user')) { |
|
| 190 | return false; |
|
| 191 | } |
|
| 192 | ||
| 193 | if ($this->getUser()->id == $user->id) { |
|
| 194 | return false; |
|
| 195 | } |
|
| 196 | ||
| 197 | return true; |
|
| 198 | } |
|
| 199 | ||
| 200 | public function canDeleteUser(User $user) |
|
| 201 | { |
|
| @@ 200-215 (lines=16) @@ | ||
| 197 | return true; |
|
| 198 | } |
|
| 199 | ||
| 200 | public function canDeleteUser(User $user) |
|
| 201 | { |
|
| 202 | if (!$this->can('user.delete')) { |
|
| 203 | return false; |
|
| 204 | } |
|
| 205 | ||
| 206 | if ($this->getUser()->id == $user->id) { |
|
| 207 | return false; |
|
| 208 | } |
|
| 209 | ||
| 210 | if ($this->getSession()->has('loginas.user')) { |
|
| 211 | return false; |
|
| 212 | } |
|
| 213 | ||
| 214 | return true; |
|
| 215 | } |
|
| 216 | ||
| 217 | public function canUpdateUser(User $user, $status = 1) |
|
| 218 | { |
|
| @@ 217-232 (lines=16) @@ | ||
| 214 | return true; |
|
| 215 | } |
|
| 216 | ||
| 217 | public function canUpdateUser(User $user, $status = 1) |
|
| 218 | { |
|
| 219 | if (!$this->can('user.update')) { |
|
| 220 | return false; |
|
| 221 | } |
|
| 222 | ||
| 223 | if ($this->getUser()->id == $user->id) { |
|
| 224 | return false; |
|
| 225 | } |
|
| 226 | ||
| 227 | if ($this->getSession()->has('loginas.user')) { |
|
| 228 | return false; |
|
| 229 | } |
|
| 230 | ||
| 231 | return true; |
|
| 232 | } |
|
| 233 | ||
| 234 | public function loginAs($id) |
|
| 235 | { |
|