diff --git a/docsrc/source/api/auth.rst b/docsrc/source/api/auth.rst index 025060fe..8b279c71 100644 --- a/docsrc/source/api/auth.rst +++ b/docsrc/source/api/auth.rst @@ -18,4 +18,8 @@ Authentication auth.update_user_account, auth.update_password, auth.update_email, - auth.logout_user + auth.logout_user, + auth.accept_privacy_policy, + auth.get_user_data_export, + auth.request_user_data_export, + auth.download_data_export \ No newline at end of file diff --git a/docsrc/source/cli.rst b/docsrc/source/cli.rst index bf349fee..06de8a5f 100644 --- a/docsrc/source/cli.rst +++ b/docsrc/source/cli.rst @@ -104,3 +104,39 @@ Modify a user account (admin rights, active status, email and password). - Reset user password (a new password will be displayed). * - ``--update-email EMAIL`` - Update user email. + + +``ftcli users clean_archives`` +"""""""""""""""""""""""""""""" +.. versionadded:: 0.7.13 + +Delete export requests and related archives created more than provided number of days. + +.. cssclass:: table-bordered +.. list-table:: + :widths: 25 50 + :header-rows: 1 + + * - Options + - Description + * - ``--days`` + - Number of days. + + + +``ftcli users export_archives`` +""""""""""""""""""""""""""""""" +.. versionadded:: 0.7.13 + +Process incomplete user export requests. +Can be used if redis is not set (no dramatiq workers running). + +.. cssclass:: table-bordered +.. list-table:: + :widths: 25 50 + :header-rows: 1 + + * - Options + - Description + * - ``--max`` + - Maximum number of export requests to process. \ No newline at end of file diff --git a/docsrc/source/features.rst b/docsrc/source/features.rst index 1542ef9f..87a5803e 100644 --- a/docsrc/source/features.rst +++ b/docsrc/source/features.rst @@ -74,9 +74,10 @@ Workouts Account & preferences ^^^^^^^^^^^^^^^^^^^^^ - A user can create, update and deleted his account. +- The user must accept the privacy policy to register. If the privacy change, a message is displayed on the dashboard to review the new version and validate it (*new in 0.7.13*). - On registration, the user account is created with selected language in dropdown as user preference (*new in 0.6.9*). - After registration, the user account is inactive and an email with confirmation instructions is sent to activate it. - A user with an inactive account cannot log in. (*new in 0.6.0*) + A user with an inactive account cannot log in. (*new in 0.6.0*). .. note:: In case email sending is not configured, a `command line `__ allows to activate users account. @@ -98,42 +99,66 @@ Account & preferences | A workout with a disabled sport will still be displayed in the application. - A user can create `clients `__ for third-party applications (*new in 0.7.0*). +- A user can request a data export (*new in 0.7.13*). Administration ^^^^^^^^^^^^^^ (*new in 0.3.0*) -- **Application** +Application +""""""""""" - The following parameters can be set: +**Configuration** - - active users limit. If 0, registration is enabled (no limit defined) - - maximum size of gpx file (individually uploaded or in a zip archive) (*changed in 0.7.4*) - - maximum size of zip archive - - maximum number of files in the zip archive (*changed in 0.7.4*) - - administrator email for contact (*new in 0.6.0*) +The following parameters can be set: - .. warning:: - Updating server configuration may be necessary to handle large files (like `nginx `_ for instance). +- active users limit. If 0, registration is enabled (no limit defined). +- maximum size of gpx file (individually uploaded or in a zip archive) (*changed in 0.7.4*) +- maximum size of zip archive +- maximum number of files in the zip archive (*changed in 0.7.4*) +- administrator email for contact (*new in 0.6.0*) - .. note:: - If email sending is disabled, a warning is displayed. +.. warning:: + Updating server configuration may be necessary to handle large files (like `nginx `_ for instance). + +.. note:: + If email sending is disabled, a warning is displayed. + +**About** + +(*new in 0.7.13*) + +| It is possible displayed additional information that may be useful to users in **About** page. +| Markdown syntax can be used. -- **Users** +**Privacy policy** - - display and filter users list - - edit a user to: - - add/remove administration rights - - activate his account (*new in 0.6.0*) - - update his email (in case his account is locked) (*new in 0.6.0*) - - reset his password (in case his account is locked) (*new in 0.6.0*). If email sending is disabled, it is only possible via CLI. - - delete a user +(*new in 0.7.13*) -- **Sports** +| A default privacy policy is available (originally adapted from the `Discourse `__ privacy policy). +| A custom privacy policy can set if needed (Markdown syntax can be used). A policy update will display a message on users dashboard to review and validate it. - - enable or disable a sport (a sport can be disabled even if workout with this sport exists) +.. note:: + Only the default privacy policy is translated (if translation is available). + +Users +""""" + +- display and filter users list +- edit a user to: + + - add/remove administration rights + - activate his account (*new in 0.6.0*) + - update his email (in case his account is locked) (*new in 0.6.0*) + - reset his password (in case his account is locked) (*new in 0.6.0*). If email sending is disabled, it is only possible via CLI. +- delete a user + + +Sports +"""""" +- enable or disable a sport (a sport can be disabled even if workout with this sport exists) Translations diff --git a/docsrc/source/installation.rst b/docsrc/source/installation.rst index ed0bd313..d7fd6866 100644 --- a/docsrc/source/installation.rst +++ b/docsrc/source/installation.rst @@ -26,7 +26,7 @@ Prerequisites - Python 3.7+ - PostgreSQL 11+ - optional - - Redis for task queue (if email sending is enabled) and API rate limits + - Redis for task queue (if email sending is enabled and for data export requests) and API rate limits - SMTP provider (if email sending is enabled) - API key from a `weather data provider `__ - `Poetry `__ (for installation from sources only) @@ -39,6 +39,9 @@ Prerequisites | On other OS, some issues can be encountered and adaptations may be necessary. +.. warning:: + | If registration is enabled, it is recommended to set Redis and a SMTP provider for email sending and data export requests. + Environment variables ~~~~~~~~~~~~~~~~~~~~~ @@ -273,11 +276,13 @@ Emails sent by FitTrackee are: - password reset request - email change (to old and new email adresses) - password change +- when a data export archive is ready to download (*new in 0.7.13*) .. versionchanged:: 0.6.5 -| For single-user instance, it is possible to disable email sending with an empty ``EMAIL_URL`` (in this case, no need to start dramatiq workers). -| A `CLI `__ is available to activate account and modify email and password. +For single-user instance, it is possible to disable email sending with an empty ``EMAIL_URL`` (in this case, no need to start dramatiq workers). + +A `CLI `__ is available to activate account, modify email and password and handle data export requests. Map tile server diff --git a/fittrackee/users/auth.py b/fittrackee/users/auth.py index 1727b06c..dbcea914 100644 --- a/fittrackee/users/auth.py +++ b/fittrackee/users/auth.py @@ -1766,7 +1766,9 @@ def request_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: """ Get a data export info for authenticated user if a request exists. + It returns: + - export creation date - export status ("in_progress", "successful" and "errored") - file name and size (in bytes) when export is successful @@ -1780,13 +1782,13 @@ def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: **Example response**: + - if a request exists + .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json - - if a request exists: - { "status": "success", "request": { @@ -1797,7 +1799,12 @@ def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: } } - - if no request: + - if no request + + .. sourcecode:: http + + HTTP/1.1 200 OK + Content-Type: application/json { "status": "success", diff --git a/fittrackee/users/commands.py b/fittrackee/users/commands.py index eb5a1a79..50e77ba4 100644 --- a/fittrackee/users/commands.py +++ b/fittrackee/users/commands.py @@ -111,7 +111,7 @@ def clean_export_archives( '--max', type=int, required=True, - help='Maximum number of archives to generate.', + help='Maximum number of export requests to process.', ) def export_archives( max: int,