* @package tao */ class AclProxy { /** * @var array */ private static $implementations; /** * get the current access control implementations * * @return array */ protected static function getImplementations() { if (is_null(self::$implementations)) { self::$implementations = [ new FuncProxy(), new DataAccessControl() ]; /* $taoExt = \common_ext_ExtensionsManager::singleton()->getExtensionById('tao'); self::$implementations = array(); foreach ($taoExt->getConfig('accessControl') as $acClass) { if (class_exists($acClass) && in_array('oat\tao\model\accessControl\AccessControl', class_implements($acClass))) { self::$implementations[] = new $acClass(); } else { throw new \common_exception_Error('Unsupported class '.$acClass); } } */ } return self::$implementations; } /** * Returns whenever or not a user has access to a specified link * * @param string $action * @param string $controller * @param string $extension * @param array $parameters * @return boolean */ public static function hasAccess(User $user, $controller, $action, $parameters) { $access = true; foreach (self::getImplementations() as $impl) { $access = $access && $impl->hasAccess($user, $controller, $action, $parameters); } return $access; } }