Ver código fonte

feat:账号权限控制管理

aiden 4 meses atrás
pai
commit
4d4e87d224

+ 108 - 0
app/controller/Menu.php

@@ -0,0 +1,108 @@
+<?php
+declare (strict_types=1);
+
+namespace app\controller;
+
+use app\BaseController;
+use app\service\MenuService;
+use think\facade\Request;
+
+class Menu extends BaseController
+{
+    /**
+     * 获取用户菜单树
+     */
+    public function getMenuTree()
+    {
+        $loginInfo = checkUserLogin();
+        if (!$loginInfo) {
+            return json_error([], '请先登录');
+        }
+        
+        try {
+            $menuTree = MenuService::getMenuTree($loginInfo);
+            return json_success($menuTree, '获取菜单成功');
+        } catch (\Exception $e) {
+            return json_error([], '获取菜单失败:' . $e->getMessage());
+        }
+    }
+
+    /**
+     * 获取面包屑导航
+     */
+    public function getBreadcrumb()
+    {
+        $loginInfo = checkUserLogin();
+        if (!$loginInfo) {
+            return json_error([], '请先登录');
+        }
+
+        $menuId = Request::get('menu_id', 0, 'intval');
+        if (!$menuId) {
+            return json_error([], '菜单ID不能为空');
+        }
+
+        try {
+            $breadcrumb = MenuService::getBreadcrumb($menuId);
+            return json_success($breadcrumb, '获取面包屑导航成功');
+        } catch (\Exception $e) {
+            return json_error([], '获取面包屑导航失败:' . $e->getMessage());
+        }
+    }
+
+    /**
+     * 获取所有控制器权限配置(用于角色权限分配)
+     */
+    public function getControllerPermissions()
+    {
+        $loginInfo = checkUserLogin();
+        if (!$loginInfo) {
+            return json_error([], '请先登录');
+        }
+        
+        // 检查是否有查看权限配置的权限
+        if (!checkPermission($loginInfo, 'Permission', 'list')) {
+            return json_error([], '没有查看权限配置的权限');
+        }
+
+        try {
+            $permissions = MenuService::getControllerPermissions();
+            return json_success($permissions, '获取权限配置成功');
+        } catch (\Exception $e) {
+            return json_error([], '获取权限配置失败:' . $e->getMessage());
+        }
+    }
+
+    /**
+     * 根据控制器检查菜单权限
+     */
+    public function checkMenuPermission()
+    {
+        $loginInfo = checkUserLogin();
+        if (!$loginInfo) {
+            return json_error([], '请先登录');
+        }
+
+        $controller = Request::get('controller', '', 'trim');
+        $action = Request::get('action', '', 'trim');
+
+        if (empty($controller)) {
+            return json_error([], '控制器名称不能为空');
+        }
+
+        $hasPermission = false;
+        if (empty($action)) {
+            // 只检查控制器权限
+            $hasPermission = checkPermission($loginInfo, $controller, 'list');
+        } else {
+            // 检查具体操作权限
+            $hasPermission = checkPermission($loginInfo, $controller, $action);
+        }
+
+        return json_success([
+            'has_permission' => $hasPermission,
+            'controller' => $controller,
+            'action' => $action
+        ], $hasPermission ? '有权限访问' : '无权限访问');
+    }
+}

+ 156 - 0
app/controller/Permission.php

@@ -0,0 +1,156 @@
+<?php
+declare (strict_types=1);
+
+namespace app\controller;
+
+use app\BaseController;
+use app\service\PermissionService;
+use think\facade\Request;
+
+class Permission extends BaseController
+{
+    /**
+     * 获取所有权限配置
+     */
+    public function list()
+    {
+        $loginInfo = checkUserLogin();
+        if (!$loginInfo) {
+            return json_error([], '请先登录');
+        }
+        
+        if (!checkPermission($loginInfo, 'Permission', 'list')) {
+            return json_error([], '没有查看权限配置的权限');
+        }
+        
+        try {
+            $permissions = PermissionService::getAllPermissions();
+            $tree = PermissionService::formatPermissionsToTree();
+            
+            return json_success([
+                'permissions' => $permissions,
+                'tree' => $tree
+            ], '获取权限配置成功');
+        } catch (\Exception $e) {
+            return json_error([], '获取权限配置失败:' . $e->getMessage());
+        }
+    }
+
+    /**
+     * 获取权限组配置
+     */
+    public function getGroups()
+    {
+        $loginInfo = checkUserLogin();
+        if (!$loginInfo) {
+            return json_error([], '请先登录');
+        }
+        
+        if (!checkPermission($loginInfo, 'Permission', 'list')) {
+            return json_error([], '没有查看权限配置的权限');
+        }
+        
+        try {
+            $groups = PermissionService::getPermissionGroups();
+            return json_success($groups, '获取权限组配置成功');
+        } catch (\Exception $e) {
+            return json_error([], '获取权限组配置失败:' . $e->getMessage());
+        }
+    }
+
+    /**
+     * 根据权限组获取权限
+     */
+    public function getPermissionsByGroup()
+    {
+        $loginInfo = checkUserLogin();
+        if (!$loginInfo) {
+            return json_error([], '请先登录');
+        }
+        
+        if (!checkPermission($loginInfo, 'Permission', 'list')) {
+            return json_error([], '没有查看权限配置的权限');
+        }
+
+        $groupName = Request::get('group', '', 'trim');
+        if (empty($groupName)) {
+            return json_error([], '权限组名称不能为空');
+        }
+
+        try {
+            $permissions = PermissionService::getPermissionsByGroup($groupName);
+            $formatted = PermissionService::formatUserPermissions($permissions);
+            
+            return json_success([
+                'permissions' => $permissions,
+                'formatted' => $formatted
+            ], '获取权限组权限成功');
+        } catch (\Exception $e) {
+            return json_error([], '获取权限组权限失败:' . $e->getMessage());
+        }
+    }
+
+    /**
+     * 验证权限格式
+     */
+    public function validatePermissions()
+    {
+        $loginInfo = checkUserLogin();
+        if (!$loginInfo) {
+            return json_error([], '请先登录');
+        }
+        
+        if (!checkPermission($loginInfo, 'Permission', 'assign')) {
+            return json_error([], '没有分配权限的权限');
+        }
+
+        $permissions = Request::post('permissions', []);
+        
+        // 如果是前端格式的权限,先转换
+        if (isset($permissions[0]) && is_string($permissions[0])) {
+            $permissions = PermissionService::parsePermissionsFromFrontend($permissions);
+        }
+
+        try {
+            $isValid = PermissionService::validatePermissions($permissions);
+            
+            return json_success([
+                'valid' => $isValid,
+                'permissions' => $permissions
+            ], $isValid ? '权限格式正确' : '权限格式错误');
+        } catch (\Exception $e) {
+            return json_error([], '验证权限格式失败:' . $e->getMessage());
+        }
+    }
+
+    /**
+     * 格式化权限(前端格式转后端格式)
+     */
+    public function formatPermissions()
+    {
+        $loginInfo = checkUserLogin();
+        if (!$loginInfo) {
+            return json_error([], '请先登录');
+        }
+
+        $permissions = Request::post('permissions', []);
+        $format = Request::post('format', 'backend'); // frontend 或 backend
+
+        try {
+            if ($format === 'frontend') {
+                // 后端格式转前端格式
+                $formatted = PermissionService::formatUserPermissions($permissions);
+            } else {
+                // 前端格式转后端格式
+                $formatted = PermissionService::parsePermissionsFromFrontend($permissions);
+            }
+            
+            return json_success([
+                'original' => $permissions,
+                'formatted' => $formatted
+            ], '权限格式转换成功');
+        } catch (\Exception $e) {
+            return json_error([], '权限格式转换失败:' . $e->getMessage());
+        }
+    }
+}

+ 208 - 0
app/service/MenuService.php

@@ -0,0 +1,208 @@
+<?php
+declare (strict_types=1);
+
+namespace app\service;
+
+use think\facade\Config;
+
+class MenuService
+{
+    /**
+     * 获取所有菜单配置
+     */
+    public static function getAllMenus(): array
+    {
+        return Config::get('menu.menus', []);
+    }
+
+    /**
+     * 根据用户权限过滤菜单
+     */
+    public static function getMenusByPermission($userInfo): array
+    {
+        $allMenus = self::getAllMenus();
+        return self::filterMenusByPermission($allMenus, $userInfo);
+    }
+
+    /**
+     * 递归过滤菜单权限
+     */
+    private static function filterMenusByPermission($menus, $userInfo): array
+    {
+        $filteredMenus = [];
+        
+        foreach ($menus as $menu) {
+            // 如果菜单指定了控制器,需要检查权限
+            if (!empty($menu['controller'])) {
+                if (!self::hasControllerPermission($userInfo, $menu['controller'])) {
+                    continue;
+                }
+            }
+            
+            // 处理子菜单
+            if (isset($menu['children']) && is_array($menu['children'])) {
+                $children = self::filterMenusByPermission($menu['children'], $userInfo);
+                // 如果有子菜单权限,才显示父菜单
+                if (!empty($children)) {
+                    $menu['children'] = $children;
+                    $filteredMenus[] = $menu;
+                }
+            } else {
+                // 没有子菜单的情况
+                if (empty($menu['controller']) || self::hasControllerPermission($userInfo, $menu['controller'])) {
+                    $filteredMenus[] = $menu;
+                }
+            }
+        }
+        
+        return $filteredMenus;
+    }
+
+    /**
+     * 检查用户是否有控制器权限
+     */
+    private static function hasControllerPermission($userInfo, $controller): bool
+    {
+        // 超级管理员拥有所有权限
+        $superAdminRoleId = Config::get('permission.super_admin_role_id', 1);
+        if ($userInfo['user_role'] == $superAdminRoleId) {
+            return true;
+        }
+
+        // 获取用户角色权限
+        $role = \app\model\UserRoleModel::getRoleById($userInfo['user_role'], $userInfo['merchant_id']);
+        if (!$role) {
+            return false;
+        }
+
+        $privileges = $role->privileges;
+        
+        // 检查是否有对应控制器的权限
+        return isset($privileges[$controller]) && is_array($privileges[$controller]) && !empty($privileges[$controller]);
+    }
+
+    /**
+     * 获取菜单树形结构(用于前端显示)
+     */
+    public static function getMenuTree($userInfo): array
+    {
+        $menus = self::getMenusByPermission($userInfo);
+        return self::buildMenuTree($menus);
+    }
+
+    /**
+     * 构建菜单树形结构
+     */
+    private static function buildMenuTree($menus): array
+    {
+        $tree = [];
+        
+        foreach ($menus as $menu) {
+            $item = [
+                'id' => $menu['id'],
+                'title' => $menu['title'],
+                'icon' => $menu['icon'] ?? '',
+                'url' => $menu['url'] ?? '',
+                'controller' => $menu['controller'] ?? '',
+                'level' => $menu['level'],
+                'sort' => $menu['sort'] ?? 0,
+            ];
+            
+            if (isset($menu['children']) && is_array($menu['children'])) {
+                $item['children'] = self::buildMenuTree($menu['children']);
+                $item['spread'] = false; // 默认不展开
+            }
+            
+            $tree[] = $item;
+        }
+        
+        // 按sort字段排序
+        usort($tree, function($a, $b) {
+            return ($a['sort'] ?? 0) - ($b['sort'] ?? 0);
+        });
+        
+        return $tree;
+    }
+
+    /**
+     * 获取所有控制器权限配置
+     */
+    public static function getControllerPermissions(): array
+    {
+        return Config::get('menu.controller_permissions', []);
+    }
+
+    /**
+     * 根据菜单ID获取菜单信息
+     */
+    public static function getMenuById($menuId): ?array
+    {
+        $allMenus = self::getAllMenus();
+        return self::findMenuById($allMenus, $menuId);
+    }
+
+    /**
+     * 递归查找菜单
+     */
+    private static function findMenuById($menus, $menuId): ?array
+    {
+        foreach ($menus as $menu) {
+            if ($menu['id'] == $menuId) {
+                return $menu;
+            }
+            
+            if (isset($menu['children']) && is_array($menu['children'])) {
+                $found = self::findMenuById($menu['children'], $menuId);
+                if ($found) {
+                    return $found;
+                }
+            }
+        }
+        
+        return null;
+    }
+
+    /**
+     * 获取面包屑导航
+     */
+    public static function getBreadcrumb($menuId): array
+    {
+        $breadcrumb = [];
+        $allMenus = self::getAllMenus();
+        
+        $path = self::getMenuPath($allMenus, $menuId);
+        
+        foreach ($path as $menu) {
+            $breadcrumb[] = [
+                'id' => $menu['id'],
+                'title' => $menu['title'],
+                'url' => $menu['url'] ?? ''
+            ];
+        }
+        
+        return $breadcrumb;
+    }
+
+    /**
+     * 获取菜单路径
+     */
+    private static function getMenuPath($menus, $menuId, $path = []): array
+    {
+        foreach ($menus as $menu) {
+            $currentPath = array_merge($path, [$menu]);
+            
+            if ($menu['id'] == $menuId) {
+                return $currentPath;
+            }
+            
+            if (isset($menu['children']) && is_array($menu['children'])) {
+                $found = self::getMenuPath($menu['children'], $menuId, $currentPath);
+                if (!empty($found)) {
+                    return $found;
+                }
+            }
+        }
+        
+        return [];
+    }
+}

+ 191 - 0
app/service/PermissionService.php

@@ -0,0 +1,191 @@
+<?php
+declare (strict_types=1);
+
+namespace app\service;
+
+use think\facade\Config;
+
+class PermissionService
+{
+    /**
+     * 获取所有权限配置
+     */
+    public static function getAllPermissions(): array
+    {
+        return Config::get('permission.permissions', []);
+    }
+
+    /**
+     * 获取权限组配置
+     */
+    public static function getPermissionGroups(): array
+    {
+        return Config::get('permission.permission_groups', []);
+    }
+
+    /**
+     * 根据权限组名获取权限配置
+     */
+    public static function getPermissionsByGroup($groupName): array
+    {
+        $groups = self::getPermissionGroups();
+        return $groups[$groupName]['permissions'] ?? [];
+    }
+
+    /**
+     * 验证权限格式
+     */
+    public static function validatePermissions($permissions): bool
+    {
+        if (!is_array($permissions)) {
+            return false;
+        }
+
+        $allPermissions = self::getAllPermissions();
+        
+        foreach ($permissions as $controller => $actions) {
+            // 检查控制器是否存在
+            if (!isset($allPermissions[$controller])) {
+                return false;
+            }
+            
+            if (!is_array($actions)) {
+                return false;
+            }
+            
+            // 检查操作是否存在
+            foreach ($actions as $action) {
+                if (!isset($allPermissions[$controller]['actions'][$action])) {
+                    return false;
+                }
+            }
+        }
+        
+        return true;
+    }
+
+    /**
+     * 格式化权限为树形结构(用于前端显示)
+     */
+    public static function formatPermissionsToTree(): array
+    {
+        $permissions = self::getAllPermissions();
+        $tree = [];
+        
+        foreach ($permissions as $controller => $config) {
+            $controllerNode = [
+                'id' => $controller,
+                'title' => $config['name'],
+                'spread' => false,
+                'children' => []
+            ];
+            
+            foreach ($config['actions'] as $action => $actionName) {
+                $controllerNode['children'][] = [
+                    'id' => $controller . '_' . $action,
+                    'title' => $actionName,
+                    'controller' => $controller,
+                    'action' => $action
+                ];
+            }
+            
+            $tree[] = $controllerNode;
+        }
+        
+        return $tree;
+    }
+
+    /**
+     * 将用户权限格式化为前端可用的格式
+     */
+    public static function formatUserPermissions($userPermissions): array
+    {
+        $formatted = [];
+        
+        if (!is_array($userPermissions)) {
+            return $formatted;
+        }
+        
+        foreach ($userPermissions as $controller => $actions) {
+            if (is_array($actions)) {
+                foreach ($actions as $action) {
+                    $formatted[] = $controller . '_' . $action;
+                }
+            }
+        }
+        
+        return $formatted;
+    }
+
+    /**
+     * 将前端提交的权限格式转换为标准格式
+     */
+    public static function parsePermissionsFromFrontend($permissions): array
+    {
+        $parsed = [];
+        
+        if (!is_array($permissions)) {
+            return $parsed;
+        }
+        
+        foreach ($permissions as $permission) {
+            if (strpos($permission, '_') !== false) {
+                [$controller, $action] = explode('_', $permission, 2);
+                
+                if (!isset($parsed[$controller])) {
+                    $parsed[$controller] = [];
+                }
+                
+                if (!in_array($action, $parsed[$controller])) {
+                    $parsed[$controller][] = $action;
+                }
+            }
+        }
+        
+        return $parsed;
+    }
+
+    /**
+     * 合并权限
+     */
+    public static function mergePermissions($permissions1, $permissions2): array
+    {
+        $merged = $permissions1;
+        
+        foreach ($permissions2 as $controller => $actions) {
+            if (!isset($merged[$controller])) {
+                $merged[$controller] = [];
+            }
+            
+            $merged[$controller] = array_unique(array_merge($merged[$controller], $actions));
+        }
+        
+        return $merged;
+    }
+
+    /**
+     * 检查权限包含关系
+     */
+    public static function hasPermission($userPermissions, $controller, $action): bool
+    {
+        return isset($userPermissions[$controller]) && 
+               is_array($userPermissions[$controller]) && 
+               in_array($action, $userPermissions[$controller]);
+    }
+
+    /**
+     * 获取用户所有可访问的控制器
+     */
+    public static function getUserAccessibleControllers($userPermissions): array
+    {
+        return array_keys($userPermissions);
+    }
+
+    /**
+     * 获取控制器的所有可访问操作
+     */
+    public static function getControllerAccessibleActions($userPermissions, $controller): array
+    {
+        return $userPermissions[$controller] ?? [];
+    }
+}

+ 133 - 0
config/menu.php

@@ -0,0 +1,133 @@
+<?php
+
+return [
+    // 菜单配置
+    'menus' => [
+        [
+            'id' => 1,
+            'title' => '玩家数据',
+            'icon' => 'layui-icon-set',
+            'controller' => '',
+            'url' => '',
+            'sort' => 1,
+            'level' => 1,
+            'parent_id' => 0,
+            'children' => [
+                [
+                    'id' => 11,
+                    'title' => '玩家列表',
+                    'icon' => 'layui-icon-user',
+                    'controller' => 'User',
+                    'url' => '/user/list',
+                    'sort' => 1,
+                    'level' => 2,
+                    'parent_id' => 1,
+                ]
+            ]
+        ],
+        [
+            'id' => 2,
+            'title' => '游戏调控',
+            'icon' => 'layui-icon-store',
+            'controller' => '',
+            'url' => '',
+            'sort' => 2,
+            'level' => 1,
+            'parent_id' => 0,
+            'children' => [
+                [
+                    'id' => 21,
+                    'title' => '游戏配置',
+                    'icon' => 'layui-icon-audit',
+                    'controller' => 'MerchantAudit',
+                    'url' => '/merchant/audit',
+                    'sort' => 2,
+                    'level' => 2,
+                    'parent_id' => 2,
+                    'children' => [
+                        [
+                            'id' => 221,
+                            'title' => '游戏配置',
+                            'icon' => '',
+                            'controller' => 'MerchantAudit',
+                            'url' => '/merchant/audit/pending',
+                            'sort' => 1,
+                            'level' => 3,
+                            'parent_id' => 22,
+                        ],
+                        [
+                            'id' => 222,
+                            'title' => '游戏批量维护',
+                            'icon' => '',
+                            'controller' => 'MerchantAudit',
+                            'url' => '/merchant/audit/passed',
+                            'sort' => 2,
+                            'level' => 3,
+                            'parent_id' => 22,
+                        ]
+                    ]
+                ]
+            ]
+        ],
+        [
+            'id' => 3,
+            'title' => '权限管理',
+            'icon' => 'layui-icon-chart',
+            'controller' => '',
+            'url' => '',
+            'sort' => 3,
+            'level' => 1,
+            'parent_id' => 0,
+            'children' => [
+                [
+                    'id' => 31,
+                    'title' => '角色列表',
+                    'icon' => 'layui-icon-chart-screen',
+                    'controller' => 'UserRole',
+                    'url' => '/statistics/user',
+                    'sort' => 1,
+                    'level' => 2,
+                    'parent_id' => 3,
+                ],
+                [
+                    'id' => 32,
+                    'title' => '商户账号列表',
+                    'icon' => 'layui-icon-data',
+                    'controller' => 'User',
+                    'url' => '/statistics/merchant',
+                    'sort' => 2,
+                    'level' => 2,
+                    'parent_id' => 3,
+                ]
+            ]
+        ]
+    ],
+
+    // 控制器对应的权限节点配置
+    'controller_permissions' => [
+        'User' => [
+            'name' => '用户管理',
+            'actions' => ['list', 'create', 'update', 'delete', 'detail']
+        ],
+        'UserRole' => [
+            'name' => '角色管理',
+            'actions' => ['list', 'create', 'update', 'delete', 'detail', 'permissions']
+        ],
+        'Permission' => [
+            'name' => '权限管理',
+            'actions' => ['list', 'assign']
+        ],
+        'Merchant' => [
+            'name' => '商户管理',
+            'actions' => ['list', 'create', 'update', 'delete', 'detail']
+        ],
+        'MerchantAudit' => [
+            'name' => '商户审核',
+            'actions' => ['pending', 'passed', 'approve', 'reject']
+        ],
+        'Statistics' => [
+            'name' => '数据统计',
+            'actions' => ['user', 'merchant', 'daily', 'monthly', 'yearly', 'income', 'users']
+        ]
+    ]
+];

+ 116 - 0
config/permission.php

@@ -0,0 +1,116 @@
+<?php
+
+return [
+    // 超级管理员角色ID
+    'super_admin_role_id' => 1,
+    
+    // 权限配置 - 用于角色权限分配时的选项显示
+    'permissions' => [
+        'User' => [
+            'name' => '用户管理',
+            'actions' => [
+                'list' => '查看用户列表',
+                'create' => '创建用户',
+                'update' => '编辑用户',
+                'delete' => '删除用户',
+                'detail' => '查看用户详情'
+            ]
+        ],
+        'UserRole' => [
+            'name' => '角色管理',
+            'actions' => [
+                'list' => '查看角色列表',
+                'create' => '创建角色',
+                'update' => '编辑角色',
+                'delete' => '删除角色',
+                'detail' => '查看角色详情',
+                'permissions' => '查看权限配置'
+            ]
+        ],
+        'Permission' => [
+            'name' => '权限管理',
+            'actions' => [
+                'list' => '查看权限配置',
+                'assign' => '分配权限'
+            ]
+        ],
+        'Menu' => [
+            'name' => '菜单管理',
+            'actions' => [
+                'list' => '查看菜单',
+                'tree' => '获取菜单树',
+                'breadcrumb' => '获取面包屑',
+                'permissions' => '查看菜单权限'
+            ]
+        ],
+        'Merchant' => [
+            'name' => '商户管理',
+            'actions' => [
+                'list' => '查看商户列表',
+                'create' => '创建商户',
+                'update' => '编辑商户',
+                'delete' => '删除商户',
+                'detail' => '查看商户详情'
+            ]
+        ],
+        'MerchantAudit' => [
+            'name' => '商户审核',
+            'actions' => [
+                'pending' => '查看待审核',
+                'passed' => '查看已审核',
+                'approve' => '审核通过',
+                'reject' => '审核拒绝'
+            ]
+        ],
+        'Statistics' => [
+            'name' => '数据统计',
+            'actions' => [
+                'user' => '用户统计',
+                'merchant' => '商户统计',
+                'daily' => '日统计',
+                'monthly' => '月统计',
+                'yearly' => '年统计',
+                'income' => '收入统计',
+                'users' => '用户数统计'
+            ]
+        ]
+    ],
+
+    // 默认权限组合(用于快速分配)
+    'permission_groups' => [
+        'viewer' => [
+            'name' => '查看者',
+            'description' => '只有查看权限',
+            'permissions' => [
+                'User' => ['list', 'detail'],
+                'UserRole' => ['list', 'detail'],
+                'Merchant' => ['list', 'detail'],
+                'Statistics' => ['user', 'merchant', 'daily', 'monthly', 'yearly']
+            ]
+        ],
+        'operator' => [
+            'name' => '操作员',
+            'description' => '有基本的增删改查权限',
+            'permissions' => [
+                'User' => ['list', 'create', 'update', 'detail'],
+                'UserRole' => ['list', 'detail'],
+                'Merchant' => ['list', 'create', 'update', 'detail'],
+                'MerchantAudit' => ['pending', 'passed'],
+                'Statistics' => ['user', 'merchant', 'daily', 'monthly', 'yearly']
+            ]
+        ],
+        'admin' => [
+            'name' => '管理员',
+            'description' => '有完整的管理权限',
+            'permissions' => [
+                'User' => ['list', 'create', 'update', 'delete', 'detail'],
+                'UserRole' => ['list', 'create', 'update', 'delete', 'detail', 'permissions'],
+                'Permission' => ['list', 'assign'],
+                'Menu' => ['list', 'tree', 'breadcrumb', 'permissions'],
+                'Merchant' => ['list', 'create', 'update', 'delete', 'detail'],
+                'MerchantAudit' => ['pending', 'passed', 'approve', 'reject'],
+                'Statistics' => ['user', 'merchant', 'daily', 'monthly', 'yearly', 'income', 'users']
+            ]
+        ]
+    ]
+];