feat(server): doc level permission (#9760)

close CLOUD-89 CLOUD-90 CLOUD-91 CLOUD-92
This commit is contained in:
Brooooooklyn
2025-02-05 07:06:57 +00:00
parent 64de83b13d
commit abeff8bb1a
36 changed files with 2257 additions and 324 deletions

View File

@@ -363,6 +363,11 @@ export const USER_FRIENDLY_ERRORS = {
},
// Workspace & Userspace & Doc & Sync errors
workspace_permission_not_found: {
type: 'internal_server_error',
args: { spaceId: 'string' },
message: ({ spaceId }) => `Space ${spaceId} permission not found.`,
},
space_not_found: {
type: 'resource_not_found',
args: { spaceId: 'string' },
@@ -395,6 +400,11 @@ export const USER_FRIENDLY_ERRORS = {
args: { spaceId: 'string' },
message: ({ spaceId }) => `Owner of Space ${spaceId} not found.`,
},
space_should_have_only_one_owner: {
type: 'invalid_input',
args: { spaceId: 'string' },
message: 'Space should have only one owner.',
},
doc_not_found: {
type: 'resource_not_found',
args: { spaceId: 'string', docId: 'string' },
@@ -438,6 +448,24 @@ export const USER_FRIENDLY_ERRORS = {
type: 'invalid_input',
message: 'Expected to revoke a public page, not a Space.',
},
expect_to_grant_doc_user_roles: {
type: 'invalid_input',
args: { spaceId: 'string', docId: 'string' },
message: ({ spaceId, docId }) =>
`Expect grant roles on doc ${docId} under Space ${spaceId}, not a Space.`,
},
expect_to_revoke_doc_user_roles: {
type: 'invalid_input',
args: { spaceId: 'string', docId: 'string' },
message: ({ spaceId, docId }) =>
`Expect revoke roles on doc ${docId} under Space ${spaceId}, not a Space.`,
},
expect_to_update_doc_user_role: {
type: 'invalid_input',
args: { spaceId: 'string', docId: 'string' },
message: ({ spaceId, docId }) =>
`Expect update roles on doc ${docId} under Space ${spaceId}, not a Space.`,
},
page_is_not_public: {
type: 'bad_request',
message: 'Page is not public.',