fs-lawrisk/permission_update_stats.md

20 lines
1.0 KiB
Markdown

Data Statistics Tab Permission Update
=====================================
I have restricted access to the "Data Statistics" (数据统计) tab in the Admin Dashboard.
**Changes Made:**
1. **Frontend (static/db_admin.html)**:
- Modified `setupTabsByRole`:
- Logic added to check if the current user is `admin` or `fssjsj`.
- 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.
- Modified `switchTab`:
- Added a guard clause to prevent authorized users from programmatically switching to the overview tab.
**Verification:**
- **Authorized Users**: `admin` and `fssjsj` can 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.