|
@@ -20,7 +20,6 @@ from tracim.models.context_models import ContentInContext
|
20
|
20
|
from tracim.exceptions import NotAuthenticated, InsufficientUserWorkspaceRole
|
21
|
21
|
from tracim.exceptions import WorkspaceNotFoundInTracimRequest
|
22
|
22
|
from tracim.exceptions import WorkspacesDoNotMatch
|
23
|
|
-from tracim.exceptions import InsufficientUserProfile
|
24
|
23
|
from tracim.exceptions import WorkspaceNotFound
|
25
|
24
|
from tracim.views.controllers import Controller
|
26
|
25
|
from tracim.views.core_api.schemas import FilterContentQuerySchema
|
|
@@ -42,7 +41,7 @@ class WorkspaceController(Controller):
|
42
|
41
|
|
43
|
42
|
@hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
|
44
|
43
|
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
|
45
|
|
- @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
|
|
44
|
+ @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
|
46
|
45
|
@hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
|
47
|
46
|
@require_workspace_role(UserRoleInWorkspace.READER)
|
48
|
47
|
@hapic.input_path(WorkspaceIdPathSchema())
|
|
@@ -62,7 +61,7 @@ class WorkspaceController(Controller):
|
62
|
61
|
|
63
|
62
|
@hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
|
64
|
63
|
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
|
65
|
|
- @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
|
|
64
|
+ @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
|
66
|
65
|
@hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
|
67
|
66
|
@require_workspace_role(UserRoleInWorkspace.READER)
|
68
|
67
|
@hapic.input_path(WorkspaceIdPathSchema())
|
|
@@ -91,7 +90,7 @@ class WorkspaceController(Controller):
|
91
|
90
|
|
92
|
91
|
@hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
|
93
|
92
|
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
|
94
|
|
- @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
|
|
93
|
+ @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
|
95
|
94
|
@hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
|
96
|
95
|
@require_workspace_role(UserRoleInWorkspace.READER)
|
97
|
96
|
@hapic.input_path(WorkspaceIdPathSchema())
|
|
@@ -127,7 +126,7 @@ class WorkspaceController(Controller):
|
127
|
126
|
|
128
|
127
|
@hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
|
129
|
128
|
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
|
130
|
|
- @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
|
|
129
|
+ @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
|
131
|
130
|
@hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
|
132
|
131
|
@require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
|
133
|
132
|
@hapic.input_path(WorkspaceIdPathSchema())
|
|
@@ -160,12 +159,11 @@ class WorkspaceController(Controller):
|
160
|
159
|
|
161
|
160
|
@hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
|
162
|
161
|
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
|
163
|
|
- @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
|
164
|
162
|
@hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
|
165
|
163
|
@hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
|
166
|
164
|
@hapic.handle_exception(WorkspacesDoNotMatch, HTTPStatus.BAD_REQUEST)
|
167
|
|
- @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
|
168
|
|
- @require_candidate_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
|
|
165
|
+ @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
|
|
166
|
+ @require_candidate_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
|
169
|
167
|
@hapic.input_path(WorkspaceAndContentIdPathSchema())
|
170
|
168
|
@hapic.input_body(ContentMoveSchema())
|
171
|
169
|
@hapic.output_body(ContentDigestSchema()) # nopep8
|
|
@@ -216,9 +214,9 @@ class WorkspaceController(Controller):
|
216
|
214
|
|
217
|
215
|
@hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
|
218
|
216
|
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
|
219
|
|
- @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
|
|
217
|
+ @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
|
220
|
218
|
@hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
|
221
|
|
- @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
|
|
219
|
+ @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
|
222
|
220
|
@hapic.input_path(WorkspaceAndContentIdPathSchema())
|
223
|
221
|
@hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8
|
224
|
222
|
def delete_content(
|
|
@@ -251,9 +249,9 @@ class WorkspaceController(Controller):
|
251
|
249
|
|
252
|
250
|
@hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
|
253
|
251
|
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
|
254
|
|
- @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
|
|
252
|
+ @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
|
255
|
253
|
@hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
|
256
|
|
- @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
|
|
254
|
+ @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
|
257
|
255
|
@hapic.input_path(WorkspaceAndContentIdPathSchema())
|
258
|
256
|
@hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8
|
259
|
257
|
def undelete_content(
|
|
@@ -287,9 +285,9 @@ class WorkspaceController(Controller):
|
287
|
285
|
|
288
|
286
|
@hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
|
289
|
287
|
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
|
290
|
|
- @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
|
|
288
|
+ @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
|
291
|
289
|
@hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
|
292
|
|
- @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
|
|
290
|
+ @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
|
293
|
291
|
@hapic.input_path(WorkspaceAndContentIdPathSchema())
|
294
|
292
|
@hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8
|
295
|
293
|
def archive_content(
|
|
@@ -319,9 +317,9 @@ class WorkspaceController(Controller):
|
319
|
317
|
|
320
|
318
|
@hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
|
321
|
319
|
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
|
322
|
|
- @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
|
|
320
|
+ @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
|
323
|
321
|
@hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
|
324
|
|
- @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
|
|
322
|
+ @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
|
325
|
323
|
@hapic.input_path(WorkspaceAndContentIdPathSchema())
|
326
|
324
|
@hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8
|
327
|
325
|
def unarchive_content(
|