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