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:
tajniak81andClaude Opus 5.5 committed 2026-10-31 16:39:21 +01:00
1 parent 342d073460
commit 34660c6b46
21 files changed
+1667 -7

No files matched your search

+50
View File
@@ -264,6 +264,22 @@ type Error struct {
MfaId *string `json:"mfaId,omitempty"`
}
// Group defines model for Group.
type Group struct {
Created string `json:"created"`
Description string `json:"description"`
Id string `json:"id"`
Members int `json:"members"`
Name string `json:"name"`
Workspace string `json:"workspace"`
}
// GroupRequest defines model for GroupRequest.
type GroupRequest struct {
Description *string `json:"description,omitempty"`
Name *string `json:"name,omitempty"`
}
// InstanceSettings defines model for InstanceSettings.
type InstanceSettings struct {
Auth AuthSettings `json:"auth"`
@@ -334,6 +350,13 @@ type LoginRequest struct {
Password string `json:"password"`
}
// MemberUser defines model for MemberUser.
type MemberUser struct {
Email string `json:"email"`
Id string `json:"id"`
Name string `json:"name"`
}
// NameRequest defines model for NameRequest.
type NameRequest struct {
Name string `json:"name"`
@@ -481,6 +504,15 @@ type Space struct {
// SpaceDefaultRole Role that workspace members (not guests) get in an open space without an explicit role.
type SpaceDefaultRole string
// SpaceGroup defines model for SpaceGroup.
type SpaceGroup struct {
Group struct {
Id string `json:"id"`
Name string `json:"name"`
} `json:"group"`
Role SpaceRole `json:"role"`
}
// SpaceMember defines model for SpaceMember.
type SpaceMember struct {
Role SpaceRole `json:"role"`
@@ -685,6 +717,12 @@ type UpdateSpaceJSONBody struct {
Visibility *SpaceVisibility `json:"visibility,omitempty"`
}
// SetSpaceGroupJSONBody defines parameters for SetSpaceGroup.
type SetSpaceGroupJSONBody struct {
Group string `json:"group"`
Role SpaceRole `json:"role"`
}
// SetSpaceMemberJSONBody defines parameters for SetSpaceMember.
type SetSpaceMemberJSONBody struct {
Email openapi_types.Email `json:"email"`
@@ -768,6 +806,12 @@ type ConfirmVerificationJSONRequestBody ConfirmVerificationJSONBody
// RequestVerificationJSONRequestBody defines body for RequestVerification for application/json ContentType.
type RequestVerificationJSONRequestBody = EmailRequest
// UpdateGroupJSONRequestBody defines body for UpdateGroup for application/json ContentType.
type UpdateGroupJSONRequestBody = GroupRequest
// AddGroupMemberJSONRequestBody defines body for AddGroupMember for application/json ContentType.
type AddGroupMemberJSONRequestBody = EmailRequest
// CreateInviteJSONRequestBody defines body for CreateInvite for application/json ContentType.
type CreateInviteJSONRequestBody = CreateInviteRequest
@@ -789,6 +833,9 @@ type MovePageJSONRequestBody MovePageJSONBody
// UpdateSpaceJSONRequestBody defines body for UpdateSpace for application/json ContentType.
type UpdateSpaceJSONRequestBody UpdateSpaceJSONBody
// SetSpaceGroupJSONRequestBody defines body for SetSpaceGroup for application/json ContentType.
type SetSpaceGroupJSONRequestBody SetSpaceGroupJSONBody
// SetSpaceMemberJSONRequestBody defines body for SetSpaceMember for application/json ContentType.
type SetSpaceMemberJSONRequestBody SetSpaceMemberJSONBody
@@ -807,6 +854,9 @@ type CreateWorkspaceJSONRequestBody CreateWorkspaceJSONBody
// RenameWorkspaceJSONRequestBody defines body for RenameWorkspace for application/json ContentType.
type RenameWorkspaceJSONRequestBody = NameRequest
// CreateGroupJSONRequestBody defines body for CreateGroup for application/json ContentType.
type CreateGroupJSONRequestBody = GroupRequest
// SetWorkspaceMemberJSONRequestBody defines body for SetWorkspaceMember for application/json ContentType.
type SetWorkspaceMemberJSONRequestBody SetWorkspaceMemberJSONBody