diff --git a/docs/source/authentication/authentication.rst b/docs/source/authentication/authentication.rst index 4b083d4..de5126c 100644 --- a/docs/source/authentication/authentication.rst +++ b/docs/source/authentication/authentication.rst @@ -1,2 +1,37 @@ Authentication -~~~~ \ No newline at end of file +============== + +Authentication is performed using OAuth2 protocol. The implementation is based on +`django-oauth2-providers `_ Django application so for generale +documentation overview refer to the official documentation. Here we only explain the difference of the MOST implementation. + +MOST implementation requires also the *taskgroup* field to get an access_token in the REST call. + +REST API +******** + +.. http:post:: /oauth2/access_token/ + + It authenticates the client providing an access token which can be used in subsequent REST calls. + The request data are: + + * client_id: the id of an OAuth2 client as configured in database + * client_secret: the client secret, + * grant_type: password|pincode, + * username: the username, + * password|pincode: the password or the pincode depending on the grant_type value, + * taskgroup: the id of the taskgroup of the user + + :reqheader Content-Type: application/json + :resheader Content-Type: application/json + + **Example of correct response** + + .. sourcecode:: json + + {"access_token": "25735f2de89eff6fa7576b7f8ca5efb952a23ef7", + "expires_in": 31535999, + "refresh_token": "e2a310b568aba5f92bf8683715f862b98b1d714d", + "scope": "read", + "token_type": "Bearer" + } diff --git a/docs/source/conf.py b/docs/source/conf.py index e05bd86..06b4ad2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -44,9 +44,9 @@ 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', - 'sphinx.ext.pngmath', + 'sphinx.ext.imgmath', 'sphinx.ext.viewcode', - 'sphinx_http_domain', + 'sphinxcontrib.httpdomain', ] # Add any paths that contain templates here, relative to this directory. diff --git a/docs/source/most-web-APIs.rst b/docs/source/most-web-APIs.rst index 176baba..5ffa380 100644 --- a/docs/source/most-web-APIs.rst +++ b/docs/source/most-web-APIs.rst @@ -119,7 +119,7 @@ API Methods MostUser ```````` - .. http:method:: POST /users/user/new/ + .. http:post:: /users/user/new/ Create new user. @@ -146,7 +146,7 @@ MostUser :parameter json `data`: if success is True, it contains the created user data in json format - .. http:method:: POST /users/user/login/ + .. http:post:: /users/user/login/ Log a user in the system @@ -160,7 +160,7 @@ MostUser :parameter json `data`: if success is True, it contains the logged user data in json format - .. http:method:: GET /users/user/logout/ + .. http:get:: /users/user/logout/ Log a user out of the system @@ -172,7 +172,7 @@ MostUser :parameter str `errors`: an error string that explains the raised problems - .. http:method:: GET /users/user/(user_id)/get_user_info/ + .. http:get:: /users/user/(user_id)/get_user_info/ Get the information of the user identified by `user_id` @@ -185,7 +185,7 @@ MostUser :parameter json `data`: if success is True, it contains the data of user identified by `user_id`, in json format - .. http:method:: GET /users/user/search/ + .. http:get:: /users/user/search/ Get a list of users matching a query string in fields: username, last_name, first_name, email or certified_email @@ -201,7 +201,7 @@ MostUser data of users matching the query string, in json format - .. http:method:: POST /users/user/(user_id)/edit/ + .. http:post:: /users/user/(user_id)/edit/ Edit the information of the user identified by `user_id` @@ -214,7 +214,7 @@ MostUser :parameter json `data`: if success is True, it contains the updated data of user identified by `user_id`, in json format - .. http:method:: POST /users/user/(user_id)/deactivate/ + .. http:post:: /users/user/(user_id)/deactivate/ Deactivate the user identified by `user_id` @@ -227,7 +227,7 @@ MostUser :parameter json `data`: if success is True, it contains the keys `id` (for the user id) and `is_active` (for the activation state): - .. http:method:: POST /users/user/(user_id)/activate/ + .. http:post:: /users/user/(user_id)/activate/ Activate the user identified by `user_id` @@ -243,7 +243,7 @@ MostUser ClinicianUser ````````````` - .. http:method:: POST /users/clinician_user/new/ + .. http:post:: /users/clinician_user/new/ Create new clinician user. @@ -260,7 +260,7 @@ ClinicianUser :parameter json `data`: if success is True, it contains the created user data in json format - .. http:method:: GET /users/clinician_user/(user_id)/is_provider/ + .. http:get:: /users/clinician_user/(user_id)/is_provider/ Investigate if the clinician user, with related user identified by `user_id`, is health care provider @@ -273,7 +273,7 @@ ClinicianUser :parameter json `data`: if success is True, it contains the keys `user_id` (for the related user id) and `is_health_care_provider` (for the health care provider state) - .. http:method:: POST /users/clinician_user/(user_id)/set_provider/ + .. http:post:: /users/clinician_user/(user_id)/set_provider/ Set the clinician user, with related user identified by `user_id`, health care provider state to True @@ -286,7 +286,7 @@ ClinicianUser :parameter json `data`: if success is True, it contains the keys `user_id` (for the related user id) and `is_health_care_provider` (for the health care provider state) - .. http:method:: GET /users/clinician_user/search/ + .. http:get:: /users/clinician_user/search/ Get a list of clinician users matching a query string in fields: username, last_name, first_name, email, certified_email or specialization @@ -302,7 +302,7 @@ ClinicianUser data of clinician users matching the query string, in json format - .. http:method:: GET /users/clinician_user/(user_id)/get_user_info/ + .. http:get:: /users/clinician_user/(user_id)/get_user_info/ Get the information of the clinician user, with related user identified by `user_id` @@ -318,7 +318,7 @@ ClinicianUser TaskGroup ````````` - .. http:method:: POST /users/task_group/new/ + .. http:post:: /users/task_group/new/ Create new task group @@ -339,7 +339,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the created task group data in json format - .. http:method:: GET /users/task_group/search/ + .. http:get:: /users/task_group/search/ Get a list of task group matching a query string in fields: title, description or hospital @@ -355,7 +355,7 @@ TaskGroup data of task groups matching the query string, in json format - .. http:method:: POST /users/task_group/(task_group_id)/edit/ + .. http:post:: /users/task_group/(task_group_id)/edit/ Edit the information of the task group identified by `task_group_id` @@ -369,7 +369,7 @@ TaskGroup - .. http:method:: GET /users/task_group/list_available_states/ + .. http:get:: /users/task_group/list_available_states/ Get a list of available state of activation @@ -382,7 +382,7 @@ TaskGroup :parameter json `data`: if success is True, it contains an array of available activation states in json format - .. http:method:: POST /users/task_group/(task_group_id)/set_active_state/(active_state)/ + .. http:post:: /users/task_group/(task_group_id)/set_active_state/(active_state)/ Set the activation state `active_state` (active or inactive) to the task group identified by `task_group_id` @@ -395,7 +395,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the keys `id` (for the task group id) and `is_active` (for the activation state), in json format - .. http:method:: GET /users/task_group/(task_group_id)/is_provider/ + .. http:get:: /users/task_group/(task_group_id)/is_provider/ Investigate if the task group identified by `task_group_id` is health care provider @@ -408,7 +408,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the keys `id` (for the task group id) and `is_health_care_provider` (for the health care provider state) - .. http:method:: POST /users/task_group/(task_group_id)/set_provider/ + .. http:post:: /users/task_group/(task_group_id)/set_provider/ Set the task group identified by `task_group_id` as health care provider @@ -421,7 +421,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the keys `id` (for the task group id) and `is_active` (for the activation state), in json format - .. http:method:: POST /users/task_group/(task_group_id)/add_user/(user_id)/ + .. http:post:: /users/task_group/(task_group_id)/add_user/(user_id)/ Add the user identified by `user_id` to the task group identified by `task_group_id` @@ -434,7 +434,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `user_id` (for the user just added to the task group), in json format - .. http:method:: POST /users/task_group/(task_group_id)/remove_user/(user_id)/ + .. http:post:: /users/task_group/(task_group_id)/remove_user/(user_id)/ Remove the user identified by `user_id` from the task group identified by `task_group_id` @@ -447,7 +447,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `user_id` (for the user just removed from the task group), in json format - .. http:method:: GET /users/task_group/(task_group_id)/list_users/ + .. http:get:: /users/task_group/(task_group_id)/list_users/ List all users that belong to the task group identified by `task_group_id` @@ -460,7 +460,7 @@ TaskGroup :parameter json `data`: if success is True, it contains an array of data of users that belong to the task group, in json format - .. http:method:: POST /users/task_group/(task_group_id)/add_related_task_group/(related_task_group_id)/ + .. http:post:: /users/task_group/(task_group_id)/add_related_task_group/(related_task_group_id)/ Add the related task group identified by `related_task_group_id` to the task group identified by `task_group_id` @@ -473,7 +473,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `related_task_group_id` (for the related task group just added to the task group), in json format - .. http:method:: POST /users/task_group/(task_group_id)/remove_related_task_group/(related_task_group_id)/ + .. http:post:: /users/task_group/(task_group_id)/remove_related_task_group/(related_task_group_id)/ Remove the related task group identified by `related_task_group_id` from the task group identified by `task_group_id` @@ -486,7 +486,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `related_task_group_id` (for the related task group just removed from the task group), in json format - .. http:method:: GET /users/task_group/(task_group_id)/list_related_task_groups/ + .. http:get:: /users/task_group/(task_group_id)/list_related_task_groups/ List all related task groups that belong to the task group identified by `task_group_id` @@ -499,7 +499,7 @@ TaskGroup :parameter json `data`: if success is True, it contains an array of data of related task groups that belong to the task group, in json format - .. http:method:: GET /users/task_group/(task_group_id)/has_clinicians/ + .. http:get:: /users/task_group/(task_group_id)/has_clinicians/ Investigate if the task group identified by `task_group_id` has clinician users @@ -512,7 +512,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `clinicians_count` (for the number of clinician user that belong to task group) - .. http:method:: GET /users/task_group/(task_group_id)/list_clinicians/ + .. http:get:: /users/task_group/(task_group_id)/list_clinicians/ List all related clinician users that belong to the task group identified by `task_group_id` @@ -525,7 +525,7 @@ TaskGroup :parameter json `data`: if success is True, it contains an array of data of clinician users that belong to the task group, in json format - .. http:method:: GET /users/task_group/(task_group_id)/has_clinician_provider/ + .. http:get:: /users/task_group/(task_group_id)/has_clinician_provider/ Investigate if the task group identified by `task_group_id` has health care provider clinician users @@ -538,7 +538,7 @@ TaskGroup :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `clinicians_count` (for the number of health care provider clinician user that belong to task group) - .. http:method:: GET /users/task_group/(task_group_id)/list_clinician_providers/ + .. http:get:: /users/task_group/(task_group_id)/list_clinician_providers/ List all health care provider clinician users that belong to the task group identified by `task_group_id` diff --git a/docs/source/users/clinician_user/apis.rst b/docs/source/users/clinician_user/apis.rst index 2ec3a76..780f139 100644 --- a/docs/source/users/clinician_user/apis.rst +++ b/docs/source/users/clinician_user/apis.rst @@ -1,7 +1,7 @@ APIs ~~~~ - .. http:method:: POST /users/clinician_user/new/ + .. http:post:: /users/clinician_user/new/ Create new clinician user. @@ -18,7 +18,7 @@ APIs :parameter json `data`: if success is True, it contains the created user data in json format - .. http:method:: GET /users/clinician_user/(user_id)/is_provider/ + .. http:get:: /users/clinician_user/(user_id)/is_provider/ Investigate if the clinician user, with related user identified by `user_id`, is health care provider @@ -31,7 +31,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `user_id` (for the related user id) and `is_health_care_provider` (for the health care provider state) - .. http:method:: POST /users/clinician_user/(user_id)/set_provider/ + .. http:post:: /users/clinician_user/(user_id)/set_provider/ Set the clinician user, with related user identified by `user_id`, health care provider state to True @@ -44,7 +44,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `user_id` (for the related user id) and `is_health_care_provider` (for the health care provider state) - .. http:method:: GET /users/clinician_user/search/ + .. http:get:: /users/clinician_user/search/ Get a list of clinician users matching a query string in fields: username, last_name, first_name, email, certified_email or specialization @@ -60,7 +60,7 @@ APIs data of clinician users matching the query string, in json format - .. http:method:: GET /users/clinician_user/(user_id)/get_user_info/ + .. http:get:: /users/clinician_user/(user_id)/get_user_info/ Get the information of the clinician user, with related user identified by `user_id` diff --git a/docs/source/users/most_user/apis.rst b/docs/source/users/most_user/apis.rst index 55b84ea..a444875 100644 --- a/docs/source/users/most_user/apis.rst +++ b/docs/source/users/most_user/apis.rst @@ -1,7 +1,7 @@ APIs ~~~~ - .. http:method:: POST /users/user/new/ + .. http:post:: /users/user/new/ Create new user. @@ -28,7 +28,7 @@ APIs :parameter json `data`: if success is True, it contains the created user data in json format - .. http:method:: POST /users/user/login/ + .. http:post:: /users/user/login/ Log a user in the system @@ -42,7 +42,7 @@ APIs :parameter json `data`: if success is True, it contains the logged user data in json format - .. http:method:: GET /users/user/logout/ + .. http:get:: /users/user/logout/ Log a user out of the system @@ -54,7 +54,7 @@ APIs :parameter str `errors`: an error string that explains the raised problems - .. http:method:: GET /users/user/(user_id)/get_user_info/ + .. http:get:: /users/user/(user_id)/get_user_info/ Get the information of the user identified by `user_id` @@ -67,7 +67,7 @@ APIs :parameter json `data`: if success is True, it contains the data of user identified by `user_id`, in json format - .. http:method:: GET /users/user/search/ + .. http:get:: /users/user/search/ Get a list of users matching a query string in fields: username, last_name, first_name, email or certified_email @@ -83,7 +83,7 @@ APIs data of users matching the query string, in json format - .. http:method:: POST /users/user/(user_id)/edit/ + .. http:post:: /users/user/(user_id)/edit/ Edit the information of the user identified by `user_id` @@ -96,7 +96,7 @@ APIs :parameter json `data`: if success is True, it contains the updated data of user identified by `user_id`, in json format - .. http:method:: POST /users/user/(user_id)/deactivate/ + .. http:post:: /users/user/(user_id)/deactivate/ Deactivate the user identified by `user_id` @@ -109,7 +109,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `id` (for the user id) and `is_active` (for the activation state): - .. http:method:: POST /users/user/(user_id)/activate/ + .. http:post:: /users/user/(user_id)/activate/ Activate the user identified by `user_id` diff --git a/docs/source/users/task_group/apis.rst b/docs/source/users/task_group/apis.rst index 47414d8..8ca356d 100644 --- a/docs/source/users/task_group/apis.rst +++ b/docs/source/users/task_group/apis.rst @@ -1,7 +1,7 @@ APIs ~~~~ - .. http:method:: POST /users/task_group/new/ + .. http:post:: /users/task_group/new/ Create new task group @@ -22,7 +22,7 @@ APIs :parameter json `data`: if success is True, it contains the created task group data in json format - .. http:method:: GET /users/task_group/search/ + .. http:get:: /users/task_group/search/ Get a list of task group matching a query string in fields: title, description or hospital @@ -38,7 +38,7 @@ APIs data of task groups matching the query string, in json format - .. http:method:: POST /users/task_group/(task_group_id)/edit/ + .. http:post:: /users/task_group/(task_group_id)/edit/ Edit the information of the task group identified by `task_group_id` @@ -52,7 +52,7 @@ APIs - .. http:method:: GET /users/task_group/list_available_states/ + .. http:get:: /users/task_group/list_available_states/ Get a list of available state of activation @@ -65,7 +65,7 @@ APIs :parameter json `data`: if success is True, it contains an array of available activation states in json format - .. http:method:: POST /users/task_group/(task_group_id)/set_active_state/(active_state)/ + .. http:post:: /users/task_group/(task_group_id)/set_active_state/(active_state)/ Set the activation state `active_state` (active or inactive) to the task group identified by `task_group_id` @@ -78,7 +78,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `id` (for the task group id) and `is_active` (for the activation state), in json format - .. http:method:: GET /users/task_group/(task_group_id)/is_provider/ + .. http:get:: /users/task_group/(task_group_id)/is_provider/ Investigate if the task group identified by `task_group_id` is health care provider @@ -91,7 +91,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `id` (for the task group id) and `is_health_care_provider` (for the health care provider state) - .. http:method:: POST /users/task_group/(task_group_id)/set_provider/ + .. http:post:: /users/task_group/(task_group_id)/set_provider/ Set the task group identified by `task_group_id` as health care provider @@ -104,7 +104,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `id` (for the task group id) and `is_active` (for the activation state), in json format - .. http:method:: POST /users/task_group/(task_group_id)/add_user/(user_id)/ + .. http:post:: /users/task_group/(task_group_id)/add_user/(user_id)/ Add the user identified by `user_id` to the task group identified by `task_group_id` @@ -117,7 +117,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `user_id` (for the user just added to the task group), in json format - .. http:method:: POST /users/task_group/(task_group_id)/remove_user/(user_id)/ + .. http:post:: /users/task_group/(task_group_id)/remove_user/(user_id)/ Remove the user identified by `user_id` from the task group identified by `task_group_id` @@ -130,7 +130,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `user_id` (for the user just removed from the task group), in json format - .. http:method:: GET /users/task_group/(task_group_id)/list_users/ + .. http:get:: /users/task_group/(task_group_id)/list_users/ List all users that belong to the task group identified by `task_group_id` @@ -143,7 +143,7 @@ APIs :parameter json `data`: if success is True, it contains an array of data of users that belong to the task group, in json format - .. http:method:: POST /users/task_group/(task_group_id)/add_related_task_group/(related_task_group_id)/ + .. http:post:: /users/task_group/(task_group_id)/add_related_task_group/(related_task_group_id)/ Add the related task group identified by `related_task_group_id` to the task group identified by `task_group_id` @@ -156,7 +156,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `related_task_group_id` (for the related task group just added to the task group), in json format - .. http:method:: POST /users/task_group/(task_group_id)/remove_related_task_group/(related_task_group_id)/ + .. http:post:: /users/task_group/(task_group_id)/remove_related_task_group/(related_task_group_id)/ Remove the related task group identified by `related_task_group_id` from the task group identified by `task_group_id` @@ -169,7 +169,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `related_task_group_id` (for the related task group just removed from the task group), in json format - .. http:method:: GET /users/task_group/(task_group_id)/list_related_task_groups/ + .. http:get:: /users/task_group/(task_group_id)/list_related_task_groups/ List all related task groups that belong to the task group identified by `task_group_id` @@ -182,7 +182,7 @@ APIs :parameter json `data`: if success is True, it contains an array of data of related task groups that belong to the task group, in json format - .. http:method:: GET /users/task_group/(task_group_id)/has_clinicians/ + .. http:get:: /users/task_group/(task_group_id)/has_clinicians/ Investigate if the task group identified by `task_group_id` has clinician users @@ -195,7 +195,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `clinicians_count` (for the number of clinician user that belong to task group) - .. http:method:: GET /users/task_group/(task_group_id)/list_clinicians/ + .. http:get:: /users/task_group/(task_group_id)/list_clinicians/ List all related clinician users that belong to the task group identified by `task_group_id` @@ -208,7 +208,7 @@ APIs :parameter json `data`: if success is True, it contains an array of data of clinician users that belong to the task group, in json format - .. http:method:: GET /users/task_group/(task_group_id)/has_clinician_provider/ + .. http:get:: /users/task_group/(task_group_id)/has_clinician_provider/ Investigate if the task group identified by `task_group_id` has health care provider clinician users @@ -221,7 +221,7 @@ APIs :parameter json `data`: if success is True, it contains the keys `task_group_id` (for the task group id) and `clinicians_count` (for the number of health care provider clinician user that belong to task group) - .. http:method:: GET /users/task_group/(task_group_id)/list_clinician_providers/ + .. http:get:: /users/task_group/(task_group_id)/list_clinician_providers/ List all health care provider clinician users that belong to the task group identified by `task_group_id`