mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 09:14:09 +02:00
Util: add auth helper methods
This commit is contained in:
parent
3c5a825f04
commit
0bc2fbe9c7
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user