示例#1
0
 private static function isAllowed($action, $page = null)
 {
     if (self::$instance == null) {
         self::getInstance();
     }
     if ($page === null) {
         $page = self::getCurrentPage();
     }
     $access = new AdminAccess(self::$instance);
     return $access->check($page, $action);
 }
示例#2
0
            $item['gid'] = $group_id;
            return $item;
        }, $access_map);
        if (!empty($access_map)) {
            Mysql::getInstance()->insert('acl', $access_map);
        }
    }
    header("Location: admin_groups.php");
    exit;
}
if (!empty($id)) {
    if (!empty($_POST['edit_action']) && !empty($_POST['name'])) {
        Admin::checkAccess(AdminAccess::ACCESS_EDIT);
        $data = array('name' => $_POST['name']);
        Mysql::getInstance()->update('admin_groups', $data, array('id' => $id));
        $access_map = AdminAccess::convertPostParamsToAccessMap($_POST);
        if (!empty($access_map)) {
            $access_map = array_map(function ($item) use($id) {
                $item['gid'] = $id;
                return $item;
            }, $access_map);
            Mysql::getInstance()->delete('acl', array('gid' => $id));
            Mysql::getInstance()->insert('acl', $access_map);
        }
        header("Location: admin_groups.php");
        exit;
    } elseif (!empty($_GET['del'])) {
        Admin::checkAccess(AdminAccess::ACCESS_DELETE);
        Mysql::getInstance()->delete('admin_groups', array('id' => $id));
        header("Location: admin_groups.php");
        exit;