1.0 KiB
1.0 KiB
Data Statistics Tab Permission Update
I have restricted access to the "Data Statistics" (数据统计) tab in the Admin Dashboard.
Changes Made:
- Frontend (static/db_admin.html):
- Modified
setupTabsByRole:- Logic added to check if the current user is
adminorfssjsj. - If unauthorized, the "Data Statistics" tab button is hidden (
display: none). - If an unauthorized user attempts to access the tab via URL (
?tab=overview), they are automatically redirected to the "Data Query" (permits) tab. - Data loading for the overview tab is prevented for unauthorized users.
- Logic added to check if the current user is
- Modified
switchTab:- Added a guard clause to prevent authorized users from programmatically switching to the overview tab.
- Modified
Verification:
- Authorized Users:
adminandfssjsjcan see and access the "Data Statistics" tab. - Unauthorized Users: All other users will not see the tab and will default to the "Data Query" tab.