Accessing the Admin Panel
Verify Admin Status
Only users with the
isAdmin flag set to true can access admin functionality. The first user created during installation is automatically granted admin privileges.Authenticate
All admin endpoints require JWT authentication. Ensure you’re logged in before making requests to
/api/admin/* endpoints.Admin Capabilities
The admin panel provides the following core capabilities:User Management
- View All Users: List all registered users with pagination support
- Create Users: Manually create new user accounts
- Update Users: Modify user details and admin permissions
- Delete Users: Remove user accounts (with safety checks)
- Reset Passwords: Generate new passwords for users
- Approve/Reject: Manage pending user registrations
System Settings
- Registration Mode: Control how new users can register
- OIDC Configuration: Configure OpenID Connect authentication
- System Statistics: View usage metrics and statistics
Statistics Dashboard
Get system-wide statistics:- Total number of users in the system
- Total number of active notes (excluding deleted)
- Total number of tags created
Admin Safety Features
Anchor implements several safety mechanisms to prevent accidental system lockouts:
Last Admin Protection
The system prevents removing admin privileges from the last admin user (server/src/admin/admin.service.ts:175):- Cannot demote the last admin to regular user
- Cannot delete the last admin account
- Ensures at least one admin always exists
Self-Demotion Prevention
Admins cannot remove their own admin status (server/src/admin/admin.service.ts:172), preventing accidental self-lockout.Cascade Deletion
When a user is deleted, their associated notes and tags are automatically removed through database cascade constraints.Authentication Flow
All admin endpoints follow this authentication flow:- JWT Validation: Request must include valid JWT token
- Admin Check: User must have
isAdmin: trueflag - Action Authorization: Some actions have additional safety checks
API Endpoints
Statistics
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/stats | Get system statistics |
Users
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/users | List all users (paginated) |
| GET | /api/admin/users/pending | List pending approvals |
| POST | /api/admin/users | Create new user |
| PATCH | /api/admin/users/:id | Update user details |
| DELETE | /api/admin/users/:id | Delete user |
| POST | /api/admin/users/:id/reset-password | Reset user password |
| POST | /api/admin/users/:id/approve | Approve pending user |
| POST | /api/admin/users/:id/reject | Reject pending user |
Settings
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/settings/registration | Get registration settings |
| PATCH | /api/admin/settings/registration | Update registration mode |
| GET | /api/admin/settings/oidc | Get OIDC settings |
| PATCH | /api/admin/settings/oidc | Update OIDC configuration |
Next Steps
User Approval
Learn how to manage user registration and approval workflows
System Settings
Configure registration modes and authentication settings