From 79aabf7745bbc460eae4aa4c78a402faaadc1268 Mon Sep 17 00:00:00 2001 From: tobias_jansen_2411 Date: Sat, 19 Dec 2020 15:19:49 +0100 Subject: [PATCH 1/6] added documentation for the Settings service --- .../SequenceDiagram_AddReportReason.svg | 274 ++++++++++++++ .../SequenceDiagram_AddReportReason.uxf | 345 ++++++++++++++++++ services/backend/settings.md | 81 ++++ 3 files changed, 700 insertions(+) create mode 100644 services/backend/SequenceDiagram_AddReportReason.svg create mode 100644 services/backend/SequenceDiagram_AddReportReason.uxf diff --git a/services/backend/SequenceDiagram_AddReportReason.svg b/services/backend/SequenceDiagram_AddReportReason.svg new file mode 100644 index 0000000..91296f9 --- /dev/null +++ b/services/backend/SequenceDiagram_AddReportReason.svg @@ -0,0 +1,274 @@ + + +!requestFormatIsValid (Middleware)!user.isAdminreportingidentitySettingsaddReportReason(req:Request)res.status(200).end()res.status(200).end()insertReportReason(reportReason:Json)response.status(400).end()response.status(400).end()insertReportReason(reportReason:Json):AxiosRequestresponse.status(200).json(user.isAdmin)response.status(401).end()getUserFromTokenisUserAdmin(user_token:String):axiosRequest diff --git a/services/backend/SequenceDiagram_AddReportReason.uxf b/services/backend/SequenceDiagram_AddReportReason.uxf new file mode 100644 index 0000000..18e4fca --- /dev/null +++ b/services/backend/SequenceDiagram_AddReportReason.uxf @@ -0,0 +1,345 @@ + + + 10 + + UMLGeneric + + 310 + 70 + 100 + 30 + + _Settings_ + + + + UMLGeneric + + 670 + 70 + 100 + 30 + + _identity_ + + + + UMLGeneric + + 920 + 70 + 100 + 30 + + _reporting_ + + + + UMLSpecialState + + 120 + 160 + 20 + 20 + + type=initial + + + + UMLSpecialState + + 150 + 700 + 20 + 20 + + type=final + + + + Relation + + 350 + 90 + 30 + 90 + + lt=. + 10.0;10.0;10.0;70.0 + + + UMLGeneric + + 350 + 160 + 20 + 320 + + + + + + Relation + + 360 + 160 + 370 + 40 + + lt=<- +isUserAdmin(user_token:String):axiosRequest + 350.0;20.0;10.0;20.0 + + + Relation + + 710 + 90 + 30 + 100 + + lt=. + 10.0;10.0;10.0;80.0 + + + UMLGeneric + + 710 + 170 + 20 + 140 + + + + + + Relation + + 720 + 180 + 190 + 80 + + lt=<- +getUserFromToken + 10.0;60.0;50.0;60.0;50.0;10.0;10.0;10.0 + + + UMLFrame + + 140 + 300 + 310 + 100 + + !user.isAdmin + + + + Relation + + 160 + 330 + 210 + 40 + + lt=<. +response.status(401).end() + 10.0;20.0;190.0;20.0 + + + Relation + + 360 + 270 + 370 + 40 + + lt=<. +response.status(200).json(user.isAdmin) + 10.0;20.0;350.0;20.0 + + + UMLSpecialState + + 150 + 340 + 20 + 20 + + type=final + + + + UMLGeneric + + 960 + 420 + 20 + 270 + + + + + + Relation + + 960 + 90 + 30 + 350 + + lt=. + 10.0;10.0;10.0;330.0 + + + Relation + + 360 + 420 + 620 + 40 + + lt=<- +insertReportReason(reportReason:Json):AxiosRequest + 600.0;20.0;10.0;20.0 + + + UMLFrame + + 140 + 490 + 890 + 100 + + !requestFormatIsValid (Middleware) + + + + Relation + + 360 + 510 + 620 + 40 + + lt=<. +response.status(400).end() + 10.0;20.0;600.0;20.0 + + + Relation + + 350 + 470 + 30 + 70 + + lt=. + 10.0;10.0;10.0;50.0 + + + UMLGeneric + + 350 + 520 + 20 + 60 + + + + + + UMLSpecialState + + 150 + 550 + 20 + 20 + + type=final + + + + Relation + + 160 + 540 + 210 + 40 + + lt=<. +response.status(400).end() + 10.0;20.0;190.0;20.0 + + + Relation + + 970 + 590 + 340 + 90 + + lt=<- +insertReportReason(reportReason:Json) + 10.0;70.0;70.0;70.0;70.0;10.0;10.0;10.0 + + + Relation + + 350 + 570 + 30 + 120 + + lt=. + 10.0;10.0;10.0;100.0 + + + Relation + + 360 + 660 + 620 + 40 + + lt=<. +res.status(200).end() + 10.0;20.0;600.0;20.0 + + + UMLGeneric + + 350 + 670 + 20 + 60 + + + + + + Relation + + 160 + 690 + 210 + 40 + + lt=<. +res.status(200).end() + 10.0;20.0;190.0;20.0 + + + Relation + + 130 + 150 + 240 + 40 + + lt=<- +addReportReason(req:Request) + 220.0;20.0;10.0;20.0 + + diff --git a/services/backend/settings.md b/services/backend/settings.md index e69de29..7b364c2 100644 --- a/services/backend/settings.md +++ b/services/backend/settings.md @@ -0,0 +1,81 @@ +#Settings +- [Description](#description) +- [Rest interfaces](#Rest interfaces) +- [Example use case execution](#Example Add Report reason) + +## Description +The Settings service provides an interface to the admin panel frontend and carries out the settings to the other services +As visible from the [Use Case diagram](#Use case diagram) the Settings service carries out a few tasks by itself whilst forwarding certain other request to the [identity service](identity-service.md) and the [reporting service](reporting.md). + +#### Use Case Diagram +![UseCaseDiagram](../../usecases/UseCaseDiagramAdminPanel.png) + +###Rest interface +``` +GET: /settings/report-reason +``` +Returns all report reasons as a JSON array + +``` +POST: /settings/report-reason +body: +{ + "reason": "some reason", + "max_report_violations": 5 +} +``` +adds a new report reason + +``` +PUT: /settings/report-reason +body: +{ + "id": 123, + "reason": "some reason", + "max_report_violations": 5 +} +``` +Edits an existing report reason + +``` +DELETE: /settings/report-reason +headers: + - "id": 123 +``` +Deletes a report reason with an id that is provided as a header + + +``` +GET: /settings/security +``` +returns the current security settings +``` +PUT: /settings/security +body: +{ + "two_factor_auth": { + "on" : true, + "phone": false, + "email": true + }, + "confirmed_emails_only": true, + "individual_pwd_req": { + "on": true, + "upper_case": true, + "number": true, + "special_char": true, + "reg_ex": false, + "reg_ex_string": "[]" + }, + "inv_only": { + "on": false, + "inv_only_by_adm": false + } +} +``` +Edits the security settings. The new settings are provided in body. +##Example Add Report reason +![Sequence Diagram](SequenceDiagram_AddReportReason.svg) +The sequence diagram shows an example of the communication of the settings service with the aforementioned services. +Firstly by checking at the identity service, if the user who sent out the request is in fact an administrator and then adding the reason in the reporting service. +This way each service has a clearly defined task. From f90b2ff495dc4f95e9f59cc29cbdfea121c52f14 Mon Sep 17 00:00:00 2001 From: tobias_jansen_2411 Date: Sat, 19 Dec 2020 15:20:58 +0100 Subject: [PATCH 2/6] added documentation for the Settings service --- services/backend/settings.md | 1 + 1 file changed, 1 insertion(+) diff --git a/services/backend/settings.md b/services/backend/settings.md index 7b364c2..ba6a939 100644 --- a/services/backend/settings.md +++ b/services/backend/settings.md @@ -11,6 +11,7 @@ As visible from the [Use Case diagram](#Use case diagram) the Settings service c ![UseCaseDiagram](../../usecases/UseCaseDiagramAdminPanel.png) ###Rest interface +The settings service provides the following rest endpoints: ``` GET: /settings/report-reason ``` From 13092daf17dd44c88eef66f27ffd432b65dbdc59 Mon Sep 17 00:00:00 2001 From: tobias_jansen_2411 Date: Sat, 19 Dec 2020 15:34:27 +0100 Subject: [PATCH 3/6] added links to subsections --- services/backend/settings.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/services/backend/settings.md b/services/backend/settings.md index ba6a939..178882d 100644 --- a/services/backend/settings.md +++ b/services/backend/settings.md @@ -1,6 +1,8 @@ #Settings - [Description](#description) -- [Rest interfaces](#Rest interfaces) +- [Rest interfaces](#Rest interfaces) + - [Reporting settings](#Reporting settings) + - [Security settings](#Security settings) - [Example use case execution](#Example Add Report reason) ## Description @@ -10,12 +12,13 @@ As visible from the [Use Case diagram](#Use case diagram) the Settings service c #### Use Case Diagram ![UseCaseDiagram](../../usecases/UseCaseDiagramAdminPanel.png) -###Rest interface +###Rest interfaces The settings service provides the following rest endpoints: +####Reporting settings ``` GET: /settings/report-reason ``` -Returns all report reasons as a JSON array +Returns all report reasons as a JSON array. ``` POST: /settings/report-reason @@ -25,7 +28,7 @@ body: "max_report_violations": 5 } ``` -adds a new report reason +adds a new report reason. ``` PUT: /settings/report-reason @@ -36,20 +39,22 @@ body: "max_report_violations": 5 } ``` -Edits an existing report reason +Edits an existing report reason. + ``` DELETE: /settings/report-reason headers: - "id": 123 ``` -Deletes a report reason with an id that is provided as a header - +Deletes a report reason with an id that is provided as a header. +####Security settings ``` GET: /settings/security ``` -returns the current security settings +returns the current security settings. + ``` PUT: /settings/security body: @@ -75,6 +80,7 @@ body: } ``` Edits the security settings. The new settings are provided in body. + ##Example Add Report reason ![Sequence Diagram](SequenceDiagram_AddReportReason.svg) The sequence diagram shows an example of the communication of the settings service with the aforementioned services. From f170ff385028d041f13c746130dcc1c36f29d109 Mon Sep 17 00:00:00 2001 From: tobias_jansen_2411 Date: Sat, 19 Dec 2020 15:38:42 +0100 Subject: [PATCH 4/6] added link to use cases --- services/backend/settings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/backend/settings.md b/services/backend/settings.md index 178882d..351dcc4 100644 --- a/services/backend/settings.md +++ b/services/backend/settings.md @@ -8,8 +8,8 @@ ## Description The Settings service provides an interface to the admin panel frontend and carries out the settings to the other services As visible from the [Use Case diagram](#Use case diagram) the Settings service carries out a few tasks by itself whilst forwarding certain other request to the [identity service](identity-service.md) and the [reporting service](reporting.md). - -#### Use Case Diagram +The use cases and their descriptions can be found [here](../../usecases/index-admin.md). +##### Use Case Diagram ![UseCaseDiagram](../../usecases/UseCaseDiagramAdminPanel.png) ###Rest interfaces From e75f9191e3c3c62ab2952e516ffcd7d30c0fc76e Mon Sep 17 00:00:00 2001 From: tobias_jansen_2411 Date: Mon, 4 Jan 2021 12:28:14 +0100 Subject: [PATCH 5/6] added description fro reporting and settings service --- services/backend/reporting.md | 14 ++++++++++++++ services/backend/settings.md | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/services/backend/reporting.md b/services/backend/reporting.md index e69de29..05b9472 100644 --- a/services/backend/reporting.md +++ b/services/backend/reporting.md @@ -0,0 +1,14 @@ +#Reporting Service +- [Description](#description) +- [Rest interfaces](#Rest interfaces) + - [Reporting settings](#Reporting settings) + - [Security settings](#Security settings) +- [Example use case execution](#Example Add Report reason) + +##Description +The reporting service handles the reporting system. This includes administrative tasks like managing for which reasons +users can be reported, as well as the reporting system itself (reporting users and banning them). +The administrative tasks, like adding new report reasons, manually blocking and unblocking users, can be done via the +[settings service](settings.md). + +##Rest interfaces diff --git a/services/backend/settings.md b/services/backend/settings.md index 351dcc4..aecbdbb 100644 --- a/services/backend/settings.md +++ b/services/backend/settings.md @@ -1,4 +1,4 @@ -#Settings +#Settings Service - [Description](#description) - [Rest interfaces](#Rest interfaces) - [Reporting settings](#Reporting settings) From e65d28169a1a9919a298096d997280f95a27fce7 Mon Sep 17 00:00:00 2001 From: tobias_jansen_2411 Date: Mon, 4 Jan 2021 12:41:02 +0100 Subject: [PATCH 6/6] added description fro reporting and settings service --- services/backend/reporting.md | 47 +++++++++++++++++++++++++++++++++++ services/backend/settings.md | 2 ++ 2 files changed, 49 insertions(+) diff --git a/services/backend/reporting.md b/services/backend/reporting.md index 05b9472..8ac0c62 100644 --- a/services/backend/reporting.md +++ b/services/backend/reporting.md @@ -12,3 +12,50 @@ The administrative tasks, like adding new report reasons, manually blocking and [settings service](settings.md). ##Rest interfaces + +``` +GET: /report-reason/report-reason +``` +Returns all report reasons as a JSON array. + +``` +POST: /report-reason/report-reason +body: +{ + "reason": "some reason", + "max_report_violations": 5 +} +``` +adds a new report reason. + +``` +PUT: /report-reason/report-reason +body: +{ + "id": 123, + "reason": "some reason", + "max_report_violations": 5 +} +``` +Edits an existing report reason. + + +``` +DELETE: /report-reason/report-reason +headers: + - "id": 123 +``` +Deletes a report reason +``` +POST: /report +@param req request from the client. Follow this layout: + Headers: + - user_token +Body: + { + "username": "userHashOfUserBeingReported", + "reason_id": 123 + } +``` +used for reporting a user. Verifies if the user sending out the report has already reported the user for the same reason in the past 15 minutes. +In that case the report will not pass. Otherwise the report will be registered in the database \ No newline at end of file diff --git a/services/backend/settings.md b/services/backend/settings.md index aecbdbb..57cbdea 100644 --- a/services/backend/settings.md +++ b/services/backend/settings.md @@ -13,8 +13,10 @@ The use cases and their descriptions can be found [here](../../usecases/index-ad ![UseCaseDiagram](../../usecases/UseCaseDiagramAdminPanel.png) ###Rest interfaces + The settings service provides the following rest endpoints: ####Reporting settings + ``` GET: /settings/report-reason ```