feat(auth): 后台布局注入全局权限集合 UA_AUTH

This commit is contained in:
augushong
2026-10-04 01:13:00 +00:00
parent d3a44a2e1c
commit fa89908c4b
2 changed files with 7 additions and 0 deletions

View File

@@ -25,6 +25,7 @@
};
window.PATH_CONFIG = PATH_CONFIG;
</script>
<script>window.UA_AUTH = {$uaAuth|raw|default='false'};</script>
{$content_js|raw}
{:sysconfig('site','site_js_insert')}

View File

@@ -524,6 +524,12 @@ class AdminControllerBase extends BaseController
];
$this->assign($data, -1);
// 全局权限集合(前端按钮显隐等消费),-1 标记为内部字段,同体 JSON 模式自动剔除
$payload = $this->authService->getAuthPayload();
$nodeForm = $this->authService->parseNodeStr($thisController . '/index');
$payload['controller'] = explode('/', $nodeForm, 2)[0];
$this->assign('uaAuth', json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP), -1);
}
/**