mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
refactor(server): permission (#10449)
This commit is contained in:
@@ -419,6 +419,14 @@ export const USER_FRIENDLY_ERRORS = {
|
||||
args: { spaceId: 'string' },
|
||||
message: 'Space should have only one owner.',
|
||||
},
|
||||
owner_can_not_leave_workspace: {
|
||||
type: 'action_forbidden',
|
||||
message: 'Owner can not leave the workspace.',
|
||||
},
|
||||
can_not_revoke_yourself: {
|
||||
type: 'action_forbidden',
|
||||
message: 'You can not revoke your own permission.',
|
||||
},
|
||||
doc_not_found: {
|
||||
type: 'resource_not_found',
|
||||
args: { spaceId: 'string', docId: 'string' },
|
||||
|
||||
@@ -298,6 +298,18 @@ export class SpaceShouldHaveOnlyOneOwner extends UserFriendlyError {
|
||||
super('invalid_input', 'space_should_have_only_one_owner', message, args);
|
||||
}
|
||||
}
|
||||
|
||||
export class OwnerCanNotLeaveWorkspace extends UserFriendlyError {
|
||||
constructor(message?: string) {
|
||||
super('action_forbidden', 'owner_can_not_leave_workspace', message);
|
||||
}
|
||||
}
|
||||
|
||||
export class CanNotRevokeYourself extends UserFriendlyError {
|
||||
constructor(message?: string) {
|
||||
super('action_forbidden', 'can_not_revoke_yourself', message);
|
||||
}
|
||||
}
|
||||
@ObjectType()
|
||||
class DocNotFoundDataType {
|
||||
@Field() spaceId!: string
|
||||
@@ -855,6 +867,8 @@ export enum ErrorNames {
|
||||
SPACE_ACCESS_DENIED,
|
||||
SPACE_OWNER_NOT_FOUND,
|
||||
SPACE_SHOULD_HAVE_ONLY_ONE_OWNER,
|
||||
OWNER_CAN_NOT_LEAVE_WORKSPACE,
|
||||
CAN_NOT_REVOKE_YOURSELF,
|
||||
DOC_NOT_FOUND,
|
||||
DOC_ACTION_DENIED,
|
||||
VERSION_REJECTED,
|
||||
|
||||
Reference in New Issue
Block a user