Fix 5 validator blockers in groups/users admin work
1. apps.ts getVisibleAppsForUser: use getEffectiveRoleIds() so admin
gate honors group_roles inheritance (was direct user_roles only —
security bypass for group-only admins). Exported helper from
middlewares/auth.ts.
2. POST /users: switch from RegisterBody to new CreateUserBody schema
that accepts optional groupIds[]. Validates ids exist; user creation
+ auto-Everyone + requested groups happen in single transaction.
OpenAPI spec extended; api-zod and api-client-react regenerated.
3. DELETE /users/🆔 400 if req.session.userId === target (no
self-delete).
4. scripts/src/seed.ts: removed `void inArray;` AI-slop and dropped
unused inArray import.
5. Locales (ar.json + en.json): added admin.users.col.displayNameAr,
displayNameEn, language and admin.groups.searchPlaceholder.
Typecheck clean. groups-crud + service-orders + users tests pass.
Pre-existing admin-app-opens-pagination flake unrelated.
Architect re-review: PASS.
This commit is contained in:
@@ -1077,7 +1077,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RegisterBody"
|
||||
$ref: "#/components/schemas/CreateUserBody"
|
||||
responses:
|
||||
"201":
|
||||
description: Created user
|
||||
@@ -1584,6 +1584,32 @@ components:
|
||||
- email
|
||||
- password
|
||||
|
||||
CreateUserBody:
|
||||
type: object
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
displayNameAr:
|
||||
type: ["string", "null"]
|
||||
displayNameEn:
|
||||
type: ["string", "null"]
|
||||
preferredLanguage:
|
||||
type: string
|
||||
default: "ar"
|
||||
groupIds:
|
||||
type: array
|
||||
description: Initial group memberships in addition to the auto-assigned Everyone group.
|
||||
items:
|
||||
type: integer
|
||||
required:
|
||||
- username
|
||||
- email
|
||||
- password
|
||||
|
||||
LoginBody:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
Reference in New Issue
Block a user