from tracim_backend.lib.utils.request import TracimRequest from tracim_backend.lib.utils.utils import generate_documentation_swagger_tag from tracim_backend.views.controllers import Controller from tracim_backend.views.core_api.schemas import NoContentSchema from tracim_backend.views.core_api.schemas import ResetPasswordCheckTokenSchema from tracim_backend.views.core_api.schemas import ResetPasswordModifySchema from tracim_backend.views.core_api.schemas import ResetPasswordRequestSchema from tracim_backend.views.swagger_generic_section import SWAGGER_TAG__AUTHENTICATION_ENDPOINTS try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__RESET_PASSWORD_SECTION = "Reset Password" SWAGGER_TAG__AUTHENTICATION_RESET_PASSWORD_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__AUTHENTICATION_ENDPOINTS, SWAGGER_TAG__RESET_PASSWORD_SECTION) class ResetPasswordController(Controller): @hapic.with_api_doc( tags=[SWAGGER_TAG__AUTHENTICATION_RESET_PASSWORD_ENDPOINTS]) @hapic.handle_exception(MissingEmailCantResetPassword, http_code=HTTPStatus.BAD_REQUEST) @hapic.handle_exception(NotificationDisabledCantResetPassword, http_code=HTTPStatus.BAD_REQUEST) @hapic.handle_exception(ExternalAuthUserPasswordModificationDisallowed, http_code=HTTPStatus.BAD_REQUEST) @hapic.handle_exception(UserAuthTypeDisabled, http_code=HTTPStatus.BAD_REQUEST) @hapic.input_body(ResetPasswordRequestSchema()) @hapic.output_body(NoContentSchema(),
from tracim_backend.views.controllers import Controller from tracim_backend.views.core_api.schemas import NoContentSchema from tracim_backend.views.core_api.schemas import SetContentStatusSchema from tracim_backend.views.core_api.schemas import TextBasedContentModifySchema from tracim_backend.views.core_api.schemas import TextBasedContentSchema from tracim_backend.views.core_api.schemas import TextBasedRevisionSchema from tracim_backend.views.core_api.schemas import WorkspaceAndContentIdPathSchema from tracim_backend.views.swagger_generic_section import SWAGGER_TAG__CONTENT_ENDPOINTS try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__CONTENT_THREAD_SECTION = "Threads" SWAGGER_TAG__CONTENT_THREAD_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__CONTENT_THREAD_SECTION) is_thread_content = ContentTypeChecker([THREAD_TYPE]) class ThreadController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__CONTENT_THREAD_ENDPOINTS]) @check_right(is_reader) @check_right(is_thread_content) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(TextBasedContentSchema()) def get_thread(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext: """ Get thread content
WopiPutResponseSchema, ) from tracim_backend.applications.collaborative_document_edition.wopi.schema import ( WOPITokenQuerySchema, ) from tracim_backend.exceptions import TracimFileNotFound from tracim_backend.lib.core.content import ContentApi from tracim_backend.lib.utils.authorization import check_right from tracim_backend.lib.utils.authorization import is_current_content_contributor from tracim_backend.lib.utils.authorization import is_current_content_reader from tracim_backend.lib.utils.utils import generate_documentation_swagger_tag from tracim_backend.models.revision_protection import new_revision from tracim_backend.views.controllers import Controller from tracim_backend.views.core_api.schemas import ContentIdPathSchema SWAGGER_TAG__COLLABORATIVE_DOCUMENT_EDITION_WOPI_SECTION = "WOPI" SWAGGER_TAG__COLLABORATIVE_DOCUMENT_EDITION_WOPI_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__COLLABORATIVE_DOCUMENT_EDITION_ENDPOINTS, SWAGGER_TAG__COLLABORATIVE_DOCUMENT_EDITION_WOPI_SECTION, ) WOPI_BASE = COLLABORATIVE_DOCUMENT_EDITION_BASE + "/wopi" WOPI_FILES = WOPI_BASE + "/files/{content_id}" class WOPIController(Controller): """ Endpoints for WOPI API """ @hapic.with_api_doc( tags=[SWAGGER_TAG__COLLABORATIVE_DOCUMENT_EDITION_WOPI_ENDPOINTS]) @check_right(is_current_content_reader) @hapic.input_path(ContentIdPathSchema()) @hapic.input_query(WOPITokenQuerySchema()) @hapic.output_file([])
from tracim_backend.views.core_api.schemas import NoContentSchema from tracim_backend.views.core_api.schemas import ResetPasswordCheckTokenSchema from tracim_backend.views.core_api.schemas import ResetPasswordModifySchema from tracim_backend.views.core_api.schemas import ResetPasswordRequestSchema from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__AUTHENTICATION_ENDPOINTS try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__RESET_PASSWORD_SECTION = 'Reset Password' SWAGGER_TAG__AUTHENTICATION_RESET_PASSWORD_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__AUTHENTICATION_ENDPOINTS, SWAGGER_TAG__RESET_PASSWORD_SECTION ) class ResetPasswordController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__AUTHENTICATION_RESET_PASSWORD_ENDPOINTS]) # nopep8 @hapic.handle_exception(NotificationDisabledCantResetPassword, http_code=HTTPStatus.BAD_REQUEST) # nopep8 @hapic.handle_exception(ExternalAuthUserPasswordModificationDisallowed, http_code=HTTPStatus.BAD_REQUEST) @hapic.handle_exception(UserAuthTypeDisabled, http_code=HTTPStatus.BAD_REQUEST) @hapic.input_body(ResetPasswordRequestSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 def reset_password_request(self, context, request: TracimRequest, hapic_data=None): # nopep8 """ Send a request to reset password. This will result in a new email sent to the user with a token to be used for password reset operation.
from tracim_backend.views.core_api.schemas import TextBasedContentSchema from tracim_backend.views.core_api.schemas import TextBasedRevisionSchema from tracim_backend.views.core_api.schemas import \ WorkspaceAndContentIdPathSchema from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__CONTENT_HTML_DOCUMENT_SECTION = 'HTML documents' SWAGGER_TAG__CONTENT_HTML_DOCUMENT_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__CONTENT_HTML_DOCUMENT_SECTION ) class HTMLDocumentController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__CONTENT_HTML_DOCUMENT_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([HTML_DOCUMENTS_TYPE]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(TextBasedContentSchema()) def get_html_document(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext: # nopep8 """ Get html document content """ app_config = request.registry.settings['CFG']
from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__ENABLE_AND_DISABLE_SECTION from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__NOTIFICATION_SECTION from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__TRASH_AND_RESTORE_SECTION try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__USER_ENDPOINTS = 'Users' SWAGGER_TAG__USER_TRASH_AND_RESTORE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__TRASH_AND_RESTORE_SECTION ) SWAGGER_TAG__USER_ENABLE_AND_DISABLE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__ENABLE_AND_DISABLE_SECTION ) SWAGGER_TAG__USER_CONTENT_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__CONTENT_ENDPOINTS, ) SWAGGER_TAG__USER_NOTIFICATION_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__NOTIFICATION_SECTION, )
from tracim_backend.exceptions import UploadPermissionNotFound from tracim_backend.exceptions import WorkspacePublicUploadDisabledException from tracim_backend.exceptions import WrongSharePassword from tracim_backend.extensions import hapic from tracim_backend.lib.core.content import ContentApi from tracim_backend.lib.core.workspace import WorkspaceApi from tracim_backend.lib.utils.authorization import check_right from tracim_backend.lib.utils.authorization import is_content_manager from tracim_backend.lib.utils.utils import generate_documentation_swagger_tag from tracim_backend.views.controllers import Controller from tracim_backend.views.core_api.schemas import NoContentSchema from tracim_backend.views.core_api.schemas import WorkspaceIdPathSchema from tracim_backend.views.core_api.workspace_controller import SWAGGER_TAG__WORKSPACE_ENDPOINTS SWAGGER_TAG__UPLOAD_PERMISSION_SECTION = "Upload Permission" SWAGGER_TAG__WORKSPACE_UPLOAD_PERMISSION_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__WORKSPACE_ENDPOINTS, SWAGGER_TAG__UPLOAD_PERMISSION_SECTION) class UploadPermissionController(Controller): """ Endpoints for Upload Permission """ @hapic.with_api_doc( tags=[SWAGGER_TAG__WORKSPACE_UPLOAD_PERMISSION_ENDPOINTS]) @hapic.handle_exception(WorkspacePublicUploadDisabledException, HTTPStatus.BAD_REQUEST) @check_right(is_content_manager) @check_right(has_public_upload_enabled) @hapic.input_path(WorkspaceIdPathSchema()) @hapic.input_body(UploadPermissionCreationBodySchema()) @hapic.output_body(UploadPermissionSchema(many=True))
WorkspaceAndContentIdPathSchema from tracim_backend.views.core_api.schemas import WorkspaceDigestSchema from tracim_backend.views.core_api.schemas import WorkspaceIdPathSchema from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__NOTIFICATION_SECTION try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__ACCOUNT_ENDPOINTS = 'Account' SWAGGER_TAG__ACCOUNT_CONTENT_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__ACCOUNT_ENDPOINTS, SWAGGER_TAG__CONTENT_ENDPOINTS, ) SWAGGER_TAG__ACCOUNT_NOTIFICATION_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__ACCOUNT_ENDPOINTS, SWAGGER_TAG__NOTIFICATION_SECTION, ) class AccountController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__ACCOUNT_ENDPOINTS]) @check_right(is_user) @hapic.output_body(UserSchema()) def account(self, context, request: TracimRequest, hapic_data=None): """ Get user infos.
from tracim_backend.views.core_api.schemas import TextBasedContentSchema from tracim_backend.views.core_api.schemas import TextBasedRevisionSchema from tracim_backend.views.core_api.schemas import \ WorkspaceAndContentIdPathSchema # nopep8 from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__CONTENT_FOLDER_SECTION = 'Folders' SWAGGER_TAG__CONTENT_FOLDER_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__CONTENT_FOLDER_SECTION ) class FolderController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__CONTENT_FOLDER_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([FOLDER_TYPE]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(TextBasedContentSchema()) def get_folder(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext: # nopep8 """ Get folder info """ app_config = request.registry.settings['CFG']
SWAGGER_TAG__ARCHIVE_AND_RESTORE_SECTION from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__TRASH_AND_RESTORE_SECTION try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__WORKSPACE_MEMBERS_SECTION = 'Members' SWAGGER_TAG__WORKSPACE_ENDPOINTS = 'Workspaces' SWAGGER_TAG__WORKSPACE_MEMBERS_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__WORKSPACE_ENDPOINTS, SWAGGER_TAG__WORKSPACE_MEMBERS_SECTION ) SWAGGER_TAG__WORKSPACE_TRASH_AND_RESTORE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__WORKSPACE_ENDPOINTS, SWAGGER_TAG__TRASH_AND_RESTORE_SECTION ) SWAGGER_TAG__CONTENT_ALL_TRASH_AND_RESTORE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__ALL_SECTION, SWAGGER_TAG__TRASH_AND_RESTORE_SECTION ) SWAGGER_TAG__CONTENT_ALL_ARCHIVE_AND_RESTORE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__ALL_SECTION, SWAGGER_TAG__ARCHIVE_AND_RESTORE_SECTION )
from tracim_backend.views.core_api.schemas import TextBasedContentSchema from tracim_backend.views.core_api.schemas import TextBasedRevisionSchema from tracim_backend.views.core_api.schemas import \ WorkspaceAndContentIdPathSchema from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__CONTENT_THREAD_SECTION = 'Threads' SWAGGER_TAG__CONTENT_THREAD_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__CONTENT_THREAD_SECTION ) is_thread_content = ContentTypeChecker([THREAD_TYPE]) class ThreadController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__CONTENT_THREAD_ENDPOINTS]) @check_right(is_reader) @check_right(is_thread_content) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(TextBasedContentSchema()) def get_thread(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext: # nopep8 """ Get thread content """ app_config = request.registry.settings['CFG']
from tracim_backend.views.swagger_generic_section import SWAGGER_TAG__NOTIFICATION_SECTION from tracim_backend.views.swagger_generic_section import SWAGGER_TAG__TRASH_AND_RESTORE_SECTION from tracim_backend.views.swagger_generic_section import SWAGGER_TAG_EVENT_ENDPOINTS from tracim_backend.views.swagger_generic_section import SWAGGER_TAG_USER_CONFIG_ENDPOINTS from tracim_backend.views.swagger_generic_section import SWAGGER_TAG_USER_SUBSCRIPTIONS_SECTION try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__USER_ENDPOINTS = "Users" SWAGGER_TAG__USER_TRASH_AND_RESTORE_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__TRASH_AND_RESTORE_SECTION ) SWAGGER_TAG__USER_ENABLE_AND_DISABLE_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__ENABLE_AND_DISABLE_SECTION ) SWAGGER_TAG__USER_CONTENT_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__CONTENT_ENDPOINTS ) SWAGGER_TAG__USER_NOTIFICATION_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__NOTIFICATION_SECTION ) SWAGGER_TAG__USER_EVENT_ENDPOINTS = generate_documentation_swagger_tag(
WorkspaceAndContentIdPathSchema from tracim_backend.views.core_api.schemas import WorkspaceDigestSchema from tracim_backend.views.core_api.schemas import WorkspaceIdPathSchema from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__NOTIFICATION_SECTION try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__ACCOUNT_ENDPOINTS = 'Account' SWAGGER_TAG__ACCOUNT_CONTENT_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__ACCOUNT_ENDPOINTS, SWAGGER_TAG__CONTENT_ENDPOINTS, ) SWAGGER_TAG__ACCOUNT_NOTIFICATION_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__ACCOUNT_ENDPOINTS, SWAGGER_TAG__NOTIFICATION_SECTION, ) class AccountController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__ACCOUNT_ENDPOINTS]) @check_right(is_user) @hapic.output_body(UserSchema()) def account(self, context, request: TracimRequest, hapic_data=None): """ Get user infos. """
from tracim_backend.extensions import hapic from tracim_backend.lib.core.content import ContentApi from tracim_backend.lib.core.workspace import WorkspaceApi from tracim_backend.lib.utils.authorization import ContentTypeChecker from tracim_backend.lib.utils.authorization import check_right from tracim_backend.lib.utils.authorization import is_content_manager from tracim_backend.lib.utils.authorization import is_contributor from tracim_backend.lib.utils.request import TracimRequest from tracim_backend.lib.utils.utils import generate_documentation_swagger_tag from tracim_backend.views.controllers import Controller from tracim_backend.views.core_api.schemas import NoContentSchema from tracim_backend.views.core_api.schemas import WorkspaceAndContentIdPathSchema from tracim_backend.views.swagger_generic_section import SWAGGER_TAG__CONTENT_ENDPOINTS SWAGGER_TAG__CONTENT_SHARE_SECTION = "Share" SWAGGER_TAG__CONTENT_FILE_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__CONTENT_SHARE_SECTION) shareables_content_type = [FILE_TYPE] is_shareable_content_type = ContentTypeChecker(shareables_content_type) class ShareController(Controller): """ Endpoints for Share Content """ @hapic.with_api_doc(tags=[SWAGGER_TAG__CONTENT_FILE_ENDPOINTS]) @hapic.handle_exception(WorkspacePublicDownloadDisabledException, HTTPStatus.BAD_REQUEST) @check_right(is_content_manager) @check_right(is_shareable_content_type) @check_right(has_public_download_enabled) @hapic.input_path(WorkspaceAndContentIdPathSchema())
from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__ENABLE_AND_DISABLE_SECTION from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__NOTIFICATION_SECTION from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__TRASH_AND_RESTORE_SECTION try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__USER_ENDPOINTS = 'Users' SWAGGER_TAG__USER_TRASH_AND_RESTORE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__TRASH_AND_RESTORE_SECTION) SWAGGER_TAG__USER_ENABLE_AND_DISABLE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__ENABLE_AND_DISABLE_SECTION) SWAGGER_TAG__USER_CONTENT_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__CONTENT_ENDPOINTS, ) SWAGGER_TAG__USER_NOTIFICATION_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__NOTIFICATION_SECTION, ) class UserController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_CONTENT_ENDPOINTS])
from tracim_backend.config import CFG from tracim_backend.extensions import hapic from tracim_backend.lib.agenda.agenda import AgendaApi from tracim_backend.lib.utils.authorization import check_right from tracim_backend.lib.utils.authorization import has_personal_access from tracim_backend.lib.utils.authorization import is_user from tracim_backend.lib.utils.request import TracimRequest from tracim_backend.lib.utils.utils import generate_documentation_swagger_tag from tracim_backend.views.agenda_api.schemas import AgendaFilterQuerySchema from tracim_backend.views.agenda_api.schemas import AgendaSchema from tracim_backend.views.controllers import Controller from tracim_backend.views.core_api.schemas import UserIdPathSchema from tracim_backend.views.core_api.user_controller import SWAGGER_TAG__USER_ENDPOINTS SWAGGER_TAG__AGENDA_SECTION = "Agenda" SWAGGER_TAG__USER_AGENDA_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__USER_ENDPOINTS, SWAGGER_TAG__AGENDA_SECTION) class AgendaController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_AGENDA_ENDPOINTS]) @check_right(has_personal_access) @hapic.input_path(UserIdPathSchema()) @hapic.input_query(AgendaFilterQuerySchema()) @hapic.output_body(AgendaSchema(many=True)) def user_agendas(self, context, request: TracimRequest, hapic_data=None): app_config = request.registry.settings["CFG"] # type: CFG agenda_api = AgendaApi(current_user=request.current_user, session=request.dbsession, config=app_config) return agenda_api.get_user_agendas( request.candidate_user,
from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__ARCHIVE_AND_RESTORE_SECTION from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__TRASH_AND_RESTORE_SECTION try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__WORKSPACE_MEMBERS_SECTION = 'Members' SWAGGER_TAG__WORKSPACE_ENDPOINTS = 'Workspaces' SWAGGER_TAG__WORKSPACE_MEMBERS_ENDPOINTS = generate_documentation_swagger_tag( SWAGGER_TAG__WORKSPACE_ENDPOINTS, SWAGGER_TAG__WORKSPACE_MEMBERS_SECTION) SWAGGER_TAG__WORKSPACE_TRASH_AND_RESTORE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__WORKSPACE_ENDPOINTS, SWAGGER_TAG__TRASH_AND_RESTORE_SECTION) SWAGGER_TAG__CONTENT_ALL_TRASH_AND_RESTORE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__ALL_SECTION, SWAGGER_TAG__TRASH_AND_RESTORE_SECTION) SWAGGER_TAG__CONTENT_ALL_ARCHIVE_AND_RESTORE_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__ALL_SECTION, SWAGGER_TAG__ARCHIVE_AND_RESTORE_SECTION) class WorkspaceController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_profile_and_workspace_role( minimal_profile=Group.TIM_USER, minimal_required_role=UserRoleInWorkspace.READER,
from tracim_backend.views.core_api.schemas import TextBasedContentSchema from tracim_backend.views.core_api.schemas import TextBasedRevisionSchema from tracim_backend.views.core_api.schemas import \ WorkspaceAndContentIdPathSchema from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__CONTENT_HTML_DOCUMENT_SECTION = 'HTML documents' SWAGGER_TAG__CONTENT_HTML_DOCUMENT_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__CONTENT_HTML_DOCUMENT_SECTION ) is_html_document_content = ContentTypeChecker([HTML_DOCUMENTS_TYPE]) class HTMLDocumentController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__CONTENT_HTML_DOCUMENT_ENDPOINTS]) @check_right(is_reader) @check_right(is_html_document_content) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(TextBasedContentSchema()) def get_html_document(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext: # nopep8 """ Get html document content """ app_config = request.registry.settings['CFG']
from tracim_backend.views.core_api.schemas import TextBasedContentSchema from tracim_backend.views.core_api.schemas import TextBasedRevisionSchema from tracim_backend.views.core_api.schemas import \ WorkspaceAndContentIdPathSchema # nopep8 from tracim_backend.views.swagger_generic_section import \ SWAGGER_TAG__CONTENT_ENDPOINTS try: # Python 3.5+ from http import HTTPStatus except ImportError: from http import client as HTTPStatus SWAGGER_TAG__CONTENT_FOLDER_SECTION = 'Folders' SWAGGER_TAG__CONTENT_FOLDER_ENDPOINTS = generate_documentation_swagger_tag( # nopep8 SWAGGER_TAG__CONTENT_ENDPOINTS, SWAGGER_TAG__CONTENT_FOLDER_SECTION ) is_folder_content = ContentTypeChecker([FOLDER_TYPE]) class FolderController(Controller): @hapic.with_api_doc(tags=[SWAGGER_TAG__CONTENT_FOLDER_ENDPOINTS]) @check_right(is_reader) @check_right(is_folder_content) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(TextBasedContentSchema()) def get_folder(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext: # nopep8 """ Get folder info """ app_config = request.registry.settings['CFG']