import { ServerAcl, StreamAcl } from '@/modules/core/dbSchema' import { TokenResourceIdentifier } from '@/modules/core/domain/tokens/types' import { AuthContext } from '@/modules/shared/domain/authz/types' import { WorkspaceAcl } from '@/modules/workspacesCore/helpers/db' import { AvailableRoles, MaybeNullOrUndefined, Optional, ServerRoles } from '@speckle/shared' import { OperationTypeNode } from 'graphql' export type GetUserAclRole = (params: { aclTableName: typeof ServerAcl.name | typeof StreamAcl.name | typeof WorkspaceAcl.name userId: string resourceId: string }) => Promise> export type GetUserServerRole = (params: { userId: string }) => Promise> export type ValidateScopes = ( scopes: Optional, scope: string ) => Promise export type AuthorizeResolver = ( userId: MaybeNullOrUndefined, resourceId: string, requiredRole: AvailableRoles, userResourceAccessLimits: MaybeNullOrUndefined, operationType?: OperationTypeNode // This is needed to block write operations when user is server admin ) => Promise export type ValidateUserServerRole = ( context: AuthContext, requiredRole: ServerRoles ) => Promise