Admin page changes to allow creation of a user and hidden behind the admin permission
This commit is contained in:
23
README.md
23
README.md
@@ -10,6 +10,7 @@ This app is no longer a static demo. It now uses the backend API for authenticat
|
||||
- Added a shared API client with JWT handling, refresh-token retry, and normalized error messages.
|
||||
- Added shared auth/session state with `localStorage` persistence.
|
||||
- Updated the dashboard to support login and live inventory summary data.
|
||||
- Added a site-admin user creation form on the Admin page backed by `POST /api/auth/register`.
|
||||
- Added a dedicated inventory management page for CRUD operations.
|
||||
- Updated search to call the backend search endpoints.
|
||||
- Updated barcode scanning so scans look up matching inventory items through the API.
|
||||
@@ -20,7 +21,7 @@ This app is no longer a static demo. It now uses the backend API for authenticat
|
||||
| Route | Purpose |
|
||||
| --- | --- |
|
||||
| `/` | Dashboard. Shows login when signed out, or inventory summary, chart, and nearest expiry data when signed in. |
|
||||
| `/admin` | Household administration page for listing, creating, editing, inviting, and leaving households. |
|
||||
| `/admin` | Site-admin page for household administration and user creation. |
|
||||
| `/inventory` | Manage locations and inventory items. |
|
||||
| `/search` | Search items and locations, then filter results further in the UI. |
|
||||
| `/barcode` | Scan a barcode and search the inventory API for matches. |
|
||||
@@ -68,10 +69,15 @@ Households:
|
||||
- `POST /api/households/{id}/invite`
|
||||
- `DELETE /api/households/{id}/leave`
|
||||
|
||||
Users:
|
||||
|
||||
- `POST /api/auth/register`
|
||||
|
||||
Notes:
|
||||
|
||||
- Household creation is limited to users with the backend `Admin` role.
|
||||
- Household editing and member invites are available when the current user is a household admin or site admin.
|
||||
- The `/admin` route is only visible and accessible for users with the backend `Admin` role.
|
||||
- User creation on this page uses the register contract: `email`, `password`, `confirmPassword`, `firstName`, and `lastName`.
|
||||
- The register endpoint does not assign roles, so new users are created without admin access by default.
|
||||
|
||||
### Search (`src/pages/SearchPage/SearchPage.jsx`)
|
||||
|
||||
@@ -114,8 +120,7 @@ The shared API client also supports:
|
||||
|
||||
Notes:
|
||||
|
||||
- `register` is still implemented in the client helper, but there is currently no registration form in the UI.
|
||||
- If you need to create a user, use the backend Swagger UI or another client to call `POST /api/auth/register`.
|
||||
- `register` is exposed in the Admin page for site admins and does not replace the current signed-in session.
|
||||
|
||||
## API Configuration
|
||||
|
||||
@@ -207,7 +212,7 @@ npm run preview
|
||||
2. Enter an existing user email and password
|
||||
3. Sign in to unlock the protected routes and API-backed data
|
||||
|
||||
There is no registration form in the UI at the moment.
|
||||
There is no public registration form in the signed-out UI. Site admins can create accounts from `/admin`.
|
||||
|
||||
### Inventory Page
|
||||
|
||||
@@ -226,11 +231,11 @@ Important update behavior:
|
||||
|
||||
Use `/admin` to:
|
||||
|
||||
- Review all households returned for the current user
|
||||
- Create a new household when the signed-in user has the site admin role
|
||||
- Edit households the signed-in user administers
|
||||
- Review household data as a site admin
|
||||
- Create a new household
|
||||
- Invite members by email to the selected household
|
||||
- Leave a household from the same page
|
||||
- Create a new user account through the register endpoint
|
||||
|
||||
### Search Page
|
||||
|
||||
|
||||
Reference in New Issue
Block a user