diff --git a/library/Director/Acl.php b/library/Director/Acl.php index 05c4d1aa..4aa2bd21 100644 --- a/library/Director/Acl.php +++ b/library/Director/Acl.php @@ -1,16 +1,22 @@ -auth = $auth; } + /** + * Whether the given permission is available + * + * @param $name + * + * @return bool + */ public function hasPermission($name) { return $this->auth->hasPermission($name); } + /** + * List all given roles + * + * @return array + */ + public function listRoleNames() + { + return array_map( + array($this, 'getNameForRole'), + $this->getUser()->getRoles() + ); + } + + /** + * Get our user object, throws auth error if not available + * + * @return \Icinga\User + * @throws AuthenticationException + */ protected function getUser() { if (null === ($user = $this->auth->getUser())) { @@ -39,15 +76,14 @@ class Acl return $user; } - public function listRoleNames() - { - return array_map( - array($this, 'getNameForRole'), - $this->getUser()->getRoles() - ); - } - - protected function getNameForRole($role) + /** + * Get the name for a given role + * + * @param Role $role + * + * @return string + */ + protected function getNameForRole(Role $role) { return $role->getName(); }