feat: roles SPA foundations
This commit is contained in:
1 parent
80f7037d3a
commit
907949aa12
180 files changed
+4308
-835
No files matched your search
@@ -605,13 +605,34 @@ const me = {
|
||||
created_at: '2026-01-05T08:30:00Z',
|
||||
updated_at: '2026-09-10T07:00:00Z',
|
||||
display_name: 'Marta Alves',
|
||||
role: 'owner',
|
||||
}
|
||||
|
||||
const ownerRole = { id: 1, name: 'Owner', built_in: true, locked: true }
|
||||
const writerRole = { id: 3, name: 'Writer', built_in: true, locked: false }
|
||||
|
||||
const meWithAccess = {
|
||||
...me,
|
||||
author: null,
|
||||
access: {
|
||||
role: ownerRole,
|
||||
permissions: [
|
||||
{ key: 'content.read', scope: 'all' },
|
||||
{ key: 'content.create', scope: 'all' },
|
||||
{ key: 'content.update', scope: 'all' },
|
||||
{ key: 'content.delete', scope: 'all' },
|
||||
{ key: 'content.publish', scope: 'all' },
|
||||
{ key: 'settings.view', scope: 'all' },
|
||||
{ key: 'users.view', scope: 'all' },
|
||||
{ key: 'content.update:article', scope: 'own' },
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
const invite = (overrides: Record<string, unknown> = {}) => ({
|
||||
id: 7,
|
||||
kind: 'invite',
|
||||
email: 'lea.martin@renew.example',
|
||||
role: writerRole,
|
||||
status: 'pending',
|
||||
created_at: '2026-09-10T07:00:00Z',
|
||||
expires_at: '2026-09-13T07:00:00Z',
|
||||
@@ -1606,7 +1627,7 @@ export const API_GROUPS: ApiGroup[] = [
|
||||
username: 'marta',
|
||||
display_name: 'Marta Alves',
|
||||
email: 'marta@renew.example',
|
||||
role: 'owner',
|
||||
role: ownerRole,
|
||||
status: 'accepted',
|
||||
created_at: '2026-01-05T08:30:00Z',
|
||||
},
|
||||
@@ -1614,6 +1635,7 @@ export const API_GROUPS: ApiGroup[] = [
|
||||
id: 7,
|
||||
kind: 'invite',
|
||||
email: 'lea.martin@renew.example',
|
||||
role: writerRole,
|
||||
status: 'pending',
|
||||
created_at: '2026-09-10T07:00:00Z',
|
||||
},
|
||||
@@ -1666,8 +1688,14 @@ export const API_GROUPS: ApiGroup[] = [
|
||||
required: true,
|
||||
rule: 'A valid email address.',
|
||||
},
|
||||
{
|
||||
name: 'role_id',
|
||||
type: 'number',
|
||||
required: false,
|
||||
rule: 'The id of the role to give. Absent or 0 means the Writer role. The Owner role is refused.',
|
||||
},
|
||||
],
|
||||
bodySample: { email: 'lea.martin@renew.example' },
|
||||
bodySample: { email: 'lea.martin@renew.example', role_id: 3 },
|
||||
},
|
||||
),
|
||||
ownerOnly(
|
||||
@@ -1698,7 +1726,7 @@ export const API_GROUPS: ApiGroup[] = [
|
||||
"Get the current user. With a key, the key's owner.",
|
||||
'Verified user',
|
||||
[e(401, UNAUTHORIZED)],
|
||||
json(me),
|
||||
json(meWithAccess),
|
||||
),
|
||||
],
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user