mirror of
http://124.126.16.154:8888/singularity/hyperf-admin.git
synced 2026-01-15 07:35:09 +08:00
fixed permission
修改仪表盘模块显示的权限bug
This commit is contained in:
@@ -4,6 +4,7 @@ namespace HyperfAdmin\Admin\Controller;
|
||||
use Hyperf\Utils\Str;
|
||||
use HyperfAdmin\Admin\Model\FrontRoutes;
|
||||
use HyperfAdmin\Admin\Service\CommonConfig;
|
||||
use HyperfAdmin\Admin\Service\Menu;
|
||||
use HyperfAdmin\Admin\Service\ModuleProxy;
|
||||
use HyperfAdmin\BaseUtils\Constants\ErrorCode;
|
||||
use HyperfAdmin\BaseUtils\Guzzle;
|
||||
@@ -25,6 +26,23 @@ class SystemController extends AdminAbstractController
|
||||
'open_export' => false,
|
||||
'navbar_notice' => '',
|
||||
]);
|
||||
|
||||
if (isset($config['system_module']) && !$this->auth_service->isSupperAdmin()) {
|
||||
$user_id = $this->auth_service->get('id');
|
||||
|
||||
$role_ids = $this->permission_service->getUserRoleIds($user_id);
|
||||
|
||||
$router_ids = $this->permission_service->getRoleMenuIds($role_ids);
|
||||
|
||||
foreach ($config['system_module'] as $module_key => $module_value) {
|
||||
$routers = make(Menu::class)->tree([
|
||||
'module' => $module_value['name'],
|
||||
'id' => $router_ids,
|
||||
]);
|
||||
|
||||
if(empty($routers)) unset($config['system_module'][$module_key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success($config);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user