feat(server): workspace roles taken into account in project queries (#4319)
* Workspace.projects fixed * Query.project tested & fixed * personalOnly flag added * withProjectRoleOnly flag * authorizeResolver implicit workspace roles * minor cleanup * reorg + support for throwing auth errors * global error mapping * undo special borkage * CR fixes * more CR fixes * shared tests fix * minor adjustment * tests fix * see if removing cached roles fixes it? * more fixes * clean up debugging garbage
This commit is contained in:
committed by
GitHub
parent
e3d3c1446b
commit
820a1e2ebf
@@ -7,7 +7,7 @@ export const workspaceEventNamespace = 'workspace' as const
|
||||
const eventPrefix = `${workspaceEventNamespace}.` as const
|
||||
|
||||
export const WorkspaceEvents = {
|
||||
Authorized: `${eventPrefix}authorized`,
|
||||
Authorizing: `${eventPrefix}authorizing`,
|
||||
Created: `${eventPrefix}created`,
|
||||
Updated: `${eventPrefix}updated`,
|
||||
Deleted: `${eventPrefix}deleted`,
|
||||
@@ -47,7 +47,7 @@ type WorkspaceJoinedFromDiscoveryPayload = {
|
||||
}
|
||||
|
||||
export type WorkspaceEventsPayloads = {
|
||||
[WorkspaceEvents.Authorized]: WorkspaceAuthorizedPayload
|
||||
[WorkspaceEvents.Authorizing]: WorkspaceAuthorizedPayload
|
||||
[WorkspaceEvents.Created]: WorkspaceCreatedPayload
|
||||
[WorkspaceEvents.Updated]: WorkspaceUpdatedPayload
|
||||
[WorkspaceEvents.Deleted]: { workspaceId: string }
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { WorkspaceAcl, WorkspaceSeat } from '@/modules/workspacesCore/domain/types'
|
||||
import { Nullable } from '@speckle/shared'
|
||||
|
||||
export type GetWorkspaceRolesAndSeats = (params: {
|
||||
workspaceId: string
|
||||
userIds?: string[]
|
||||
}) => Promise<{
|
||||
[userId: string]: {
|
||||
role: WorkspaceAcl
|
||||
seat: Nullable<WorkspaceSeat>
|
||||
userId: string
|
||||
}
|
||||
}>
|
||||
|
||||
export type GetWorkspaceRoleAndSeat = (params: {
|
||||
workspaceId: string
|
||||
userId: string
|
||||
}) => Promise<
|
||||
| {
|
||||
role: WorkspaceAcl
|
||||
seat: Nullable<WorkspaceSeat>
|
||||
userId: string
|
||||
}
|
||||
| undefined
|
||||
>
|
||||
@@ -72,3 +72,18 @@ export type WorkspaceJoinRequest = {
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}
|
||||
|
||||
export const WorkspaceSeatType = <const>{
|
||||
Viewer: 'viewer',
|
||||
Editor: 'editor'
|
||||
}
|
||||
export type WorkspaceSeatType =
|
||||
(typeof WorkspaceSeatType)[keyof typeof WorkspaceSeatType]
|
||||
|
||||
export type WorkspaceSeat = {
|
||||
workspaceId: string
|
||||
userId: string
|
||||
type: WorkspaceSeatType
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user