from(Qs_Db::getPair('DAdminAclResource')); $select->order('sorter'); self::$_resources = Qs_Db::getInstance()->fetchAssoc($select, ['id']); } return self::$_resources; } public function setAllowedResources($resources) { self::$_allowedResources = $resources; return $this; } public static function getAllowedResources($adminId = null) { if (null === $adminId) { $adminId = App_Admin_Auth::getInstance()->getData('id'); } if (null === self::$_allowedResources) { $select = Qs_Db::getSelect(); $select->from(Qs_Db::getPair(self::getAclTableAlias()), ['aclResourceId']); $select->where('adminId = ?', $adminId, Qs_Db::INT_TYPE); self::$_allowedResources = Qs_Db::getInstance()->fetchCol($select); } return self::$_allowedResources; } public static function isAccessTo(array $resourceIds, $adminId = null) { return (bool) array_intersect($resourceIds, self::getAllowedResources($adminId)); } public static function getResource($id, $field) { return Qs_Array::get(self::getAclResources(), $id, $field); } public static function getAclTableAlias() { return self::$_aclTableAlias; } }