diff --git a/library/Director/Util.php b/library/Director/Util.php index 6053a74b..2e2e8e2b 100644 --- a/library/Director/Util.php +++ b/library/Director/Util.php @@ -2,10 +2,13 @@ namespace Icinga\Module\Director; +use Icinga\Authentication\Manager; use Zend_Db_Expr; class Util { + protected static $auth; + public static function pgBinEscape($binary) { return new \Zend_Db_Expr("'\\x" . bin2hex($binary) . "'"); @@ -20,4 +23,22 @@ class Util { return current(unpack('H*', $hex)); } + + public static function auth() + { + if (self::$auth === null) { + self::$auth = Manager::getInstance(); + } + return self::$auth; + } + + public static function hasPermission($name) + { + return self::auth()->hasPermission($name); + } + + public static function getRestrictions($name) + { + return self::auth()->getRestrictions($name); + } }