Add workspace groups with space grants
Workspace admins create groups of members, and space admins grant a role to a whole group. A member's space role is now the highest of their own grant and their groups' grants. Leaving a workspace drops its group memberships, and deleting a group removes its space grants (they are not a real relation, so PocketBase cannot cascade them). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
342d073460
commit
34660c6b46
21 files changed
+1667
-7
No files matched your search
@@ -1042,6 +1042,173 @@ paths:
|
||||
"204": { description: Sent }
|
||||
"403": { $ref: "#/components/responses/Error" }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
# Groups hold some of a workspace's members; spaces grant roles to groups
|
||||
# like to people, and a member gets the highest of the two.
|
||||
/api/v1/workspaces/{id}/groups:
|
||||
parameters:
|
||||
- { name: id, in: path, required: true, schema: { type: string } }
|
||||
get:
|
||||
operationId: listGroups
|
||||
tags: [groups]
|
||||
summary: A workspace's groups (members and above)
|
||||
security: [{ bearer: [] }]
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema: { type: array, items: { $ref: "#/components/schemas/Group" } }
|
||||
"403": { $ref: "#/components/responses/Error" }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
post:
|
||||
operationId: createGroup
|
||||
tags: [groups]
|
||||
summary: Create a group (workspace admin)
|
||||
security: [{ bearer: [] }]
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/GroupRequest" }
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/Group" }
|
||||
"400": { $ref: "#/components/responses/Error" }
|
||||
"403": { $ref: "#/components/responses/Error" }
|
||||
"409": { $ref: "#/components/responses/Error" }
|
||||
/api/v1/groups/{id}:
|
||||
parameters:
|
||||
- { name: id, in: path, required: true, schema: { type: string } }
|
||||
patch:
|
||||
operationId: updateGroup
|
||||
tags: [groups]
|
||||
summary: Rename a group or change its description (workspace admin)
|
||||
security: [{ bearer: [] }]
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/GroupRequest" }
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/Group" }
|
||||
"400": { $ref: "#/components/responses/Error" }
|
||||
"403": { $ref: "#/components/responses/Error" }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
delete:
|
||||
operationId: deleteGroup
|
||||
tags: [groups]
|
||||
summary: Delete a group and its space grants (workspace admin)
|
||||
security: [{ bearer: [] }]
|
||||
responses:
|
||||
"204": { description: Deleted }
|
||||
"403": { $ref: "#/components/responses/Error" }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
/api/v1/groups/{id}/members:
|
||||
parameters:
|
||||
- { name: id, in: path, required: true, schema: { type: string } }
|
||||
get:
|
||||
operationId: listGroupMembers
|
||||
tags: [groups]
|
||||
summary: A group's members
|
||||
security: [{ bearer: [] }]
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema: { type: array, items: { $ref: "#/components/schemas/MemberUser" } }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
put:
|
||||
operationId: addGroupMember
|
||||
tags: [groups]
|
||||
summary: Add a workspace member to a group by email (workspace admin)
|
||||
security: [{ bearer: [] }]
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/EmailRequest" }
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/MemberUser" }
|
||||
"400": { $ref: "#/components/responses/Error" }
|
||||
"403": { $ref: "#/components/responses/Error" }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
/api/v1/groups/{id}/members/{userId}:
|
||||
parameters:
|
||||
- { name: id, in: path, required: true, schema: { type: string } }
|
||||
- { name: userId, in: path, required: true, schema: { type: string } }
|
||||
delete:
|
||||
operationId: removeGroupMember
|
||||
tags: [groups]
|
||||
summary: Remove someone from a group (workspace admin)
|
||||
security: [{ bearer: [] }]
|
||||
responses:
|
||||
"204": { description: Removed }
|
||||
"403": { $ref: "#/components/responses/Error" }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
/api/v1/spaces/{id}/groups:
|
||||
parameters:
|
||||
- { name: id, in: path, required: true, schema: { type: string } }
|
||||
get:
|
||||
operationId: listSpaceGroups
|
||||
tags: [spaces]
|
||||
summary: Groups with a role in the space
|
||||
security: [{ bearer: [] }]
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema: { type: array, items: { $ref: "#/components/schemas/SpaceGroup" } }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
put:
|
||||
operationId: setSpaceGroup
|
||||
tags: [spaces]
|
||||
summary: Grant a group a role in the space (space admin)
|
||||
security: [{ bearer: [] }]
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required: [group, role]
|
||||
properties:
|
||||
group: { type: string }
|
||||
role: { $ref: "#/components/schemas/SpaceRole" }
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/SpaceGroup" }
|
||||
"400": { $ref: "#/components/responses/Error" }
|
||||
"403": { $ref: "#/components/responses/Error" }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
/api/v1/spaces/{id}/groups/{groupId}:
|
||||
parameters:
|
||||
- { name: id, in: path, required: true, schema: { type: string } }
|
||||
- { name: groupId, in: path, required: true, schema: { type: string } }
|
||||
delete:
|
||||
operationId: removeSpaceGroup
|
||||
tags: [spaces]
|
||||
summary: Take a group's role in the space away (space admin)
|
||||
security: [{ bearer: [] }]
|
||||
responses:
|
||||
"204": { description: Removed }
|
||||
"403": { $ref: "#/components/responses/Error" }
|
||||
"404": { $ref: "#/components/responses/Error" }
|
||||
components:
|
||||
securitySchemes:
|
||||
bearer:
|
||||
@@ -1408,3 +1575,36 @@ components:
|
||||
invitedBy: { type: string }
|
||||
expires: { type: string }
|
||||
hasAccount: { type: boolean, description: Sign in to accept instead of signing up }
|
||||
MemberUser:
|
||||
type: object
|
||||
required: [id, email, name]
|
||||
properties:
|
||||
id: { type: string }
|
||||
email: { type: string }
|
||||
name: { type: string }
|
||||
Group:
|
||||
type: object
|
||||
required: [id, workspace, name, description, members, created]
|
||||
properties:
|
||||
id: { type: string }
|
||||
workspace: { type: string }
|
||||
name: { type: string }
|
||||
description: { type: string }
|
||||
members: { type: integer }
|
||||
created: { type: string }
|
||||
GroupRequest:
|
||||
type: object
|
||||
properties:
|
||||
name: { type: string, maxLength: 120 }
|
||||
description: { type: string, maxLength: 500 }
|
||||
SpaceGroup:
|
||||
type: object
|
||||
required: [group, role]
|
||||
properties:
|
||||
group:
|
||||
type: object
|
||||
required: [id, name]
|
||||
properties:
|
||||
id: { type: string }
|
||||
name: { type: string }
|
||||
role: { $ref: "#/components/schemas/SpaceRole" }
|
||||
Reference in new issue
Block a user