diff --git a/docs/DeveloperGuide.adoc b/docs/DeveloperGuide.adoc index 188b3b2dcf45..4428b4ddf5d2 100644 --- a/docs/DeveloperGuide.adoc +++ b/docs/DeveloperGuide.adoc @@ -233,6 +233,74 @@ Classes used by multiple components are in the `seedu.giatrosbook.commons` packa This section describes some noteworthy details on how certain features are implemented. +// tag::authentication[] +=== User authentication feature +==== Current Implementation + +The user account mechanism is facilitated by `GiatrosBook`. Additionally, it implements the following operations: + +* `GiatrosBook#addAccount(Account)` -- Saves the new account. + +These operations are exposed in the `Model` interface as `Model#getAccount(Account)`. The following commands will +invoke the aforementioned operations: + +* `Command#LoginCommand()` -- Invokes `Model#getAccount(Account)`. +* `Command#RegisterCommand()` -- Invokes `Model#addAccount(Account)`. + +Given below are usage scenarios and how each of the command and its respective operations behave at each +step which involves two components, `Logic` which is responsible for parsing the user input and `Model` which is +responsible for manipulating the list, if necessary. Both components are extended by `LogicManager` and +`ModelManager` respectively. + +The following sequence diagram shows how the `register` command works: + +image::RegisterSequenceDiagram.png[width="800"] +_Figure 4.2.1.1: Sequence diagram to illustrate component interactions for the `register` command_ + +[NOTE] +==== +** We assume the user is already logged in to an account with appropriate privilege level (e.g. Administrator) +** If the username already exists, a warning message will be shown to the user to select another username +==== + +Step 1. The user executes `register id/ces pw/1122qq n/Chua Eng Soon` command to create a new user account. + +Step 2. `LogicManager` invokes the `GiatrosBookParser#parseCommand()` method which takes in the user input +as arguments. + +Step 3. When the command is parsed, the `Command#RegisterCommand()` will be created which is returned to the +`LogicManager`. + +Step 4. `LogicManager` invokes the `execute()` method of the `Command#RegisterCommand()`, `rc` which is instantiated in +Step 3. The `Model` component will be involved as the `Command#RegisterCommand()` invokes a request to add the account +into the storage by calling `Model#addAccount(Account)`. + +Step 5: The new account is added into the storage. Then, a `CommandResult` is generated and returned to +`LogicManager` which is used to display the result to the user. + +The following sequence diagram shows how the `login` command works: + +image::LoginSequenceDiagram.png[width="800"] +_Figure 4.2.1.2: Sequence diagram to illustrate component interactions for the `login` command_ + +[NOTE] +We assume the user will enter the correct password. Otherwise, warning message will be shown to the user to re-enter +the credential + +Step 1. The user executes `login id/ces pw/1122qq` command to login to an existing user account. + +Step 2. `LogicManager` invokes the `GiatrosBookParser#parseCommand()` method which takes in the user input +as arguments. + +Step 3. When the command is parsed, the `Command#LoginCommand()` will be created which is returned to the +`LogicManager`. + +Step 4. `LogicManager` invokes the `execute()` method of the `Command#LoginCommand()`, `lc` which is instantiated in +Step 3. The `Model` component will be involved as the `Command#LoginCommand()` invokes a request to retrieve an account +based on the username. If it exists, the account will be retrieved and the password hash will be compared. If it +matches, then the credential is valid and the user is authenticated. +// end::authentication[] + // tag::undoredo[] === Undo/Redo feature ==== Current Implementation diff --git a/docs/diagrams/LoginSequenceDiagram.pptx b/docs/diagrams/LoginSequenceDiagram.pptx new file mode 100644 index 000000000000..00a9b4a1d716 Binary files /dev/null and b/docs/diagrams/LoginSequenceDiagram.pptx differ diff --git a/docs/images/LoginSequenceDiagram.png b/docs/images/LoginSequenceDiagram.png new file mode 100644 index 000000000000..c21171c68e8f Binary files /dev/null and b/docs/images/LoginSequenceDiagram.png differ diff --git a/docs/images/RegisterSequenceDiagram.png b/docs/images/RegisterSequenceDiagram.png new file mode 100644 index 000000000000..98b10725d790 Binary files /dev/null and b/docs/images/RegisterSequenceDiagram.png differ diff --git a/docs/team/chuaes.adoc b/docs/team/chuaes.adoc index a3c1647a5159..eb47aa042b4b 100644 --- a/docs/team/chuaes.adoc +++ b/docs/team/chuaes.adoc @@ -12,20 +12,21 @@ Hi! I am Chua Eng Soon, a Computer Science undergraduate in National University of Singapore. Giatros is my first software engineering project under CS2103. An introduction is as such: -Giatros is a desktop patient record application used to keep track of patient data in a hospital. Written in Java, the user interacts with it using a CLI, and it has a GUI created with JavaFX. -With the authentication and user management components, these restrict people without proper credentials to view/edit information. + +Giatros is a desktop patient record application that allows staff to keep track of patient data in a hospital. Written in Java, the user interacts with it using a CLI, and it has a GUI created with JavaFX. +With the authentication and user management components, these restrict people without proper credentials from viewing or editing information. == Summary of contributions -* *Major enhancement*: Added *the ability to add/remove allergies* -** What it does: Allows the user to add allergies to an existing patient or remove allergies from an existing patient. -** Justification: This feature improves the product significantly because the current edit command will overwrite the existing allergies whenever new allergies are specified. The `addall` and `remall` commands allow user to add and -remove allergies from the existing list associated to a patient. -** Highlights: This enhancement extends the ability of the existing `add` and `edit` commands, which allows user to create a patient with allergies displayed as colourful tags. +* *Major enhancement*: Added the *User Authentication feature* +** What it does: Prevents user without proper credentials from executing role-restricted command and viewing of sensitive information. +** Justification: This feature provides *data protection* for sensitive information from user without proper credential. +** Highlights: 'Login', 'Logout' and 'Register' commands are available to faciliate the *User Authentication feature*. * *Minor enhancement*: -** Added colours to the various allergies for easier identification. -** Changed the UI to show the search result of the first allergy when the patient is selected. +** Change the ab4 logo to Giatros +** Change the UI to show the username of the current user at the top right corner of the gui. +** Added sample data for accounts and patients * *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ @@ -33,17 +34,17 @@ remove allergies from the existing list associated to a patient. ** Project management: *** Managed releases `v1.0` - `v1.4` (5 releases) on GitHub -** Enhancements to existing features: -*** _{to be added}_ ** Documentation: -*** _{to be added}_ -** Community: -*** _{to be added}_ +*** Updated the Product Website +*** Updated the user guide +*** Updated the developed guide +*** Updated the portfolio page + ** Tools: *** Created an organization repository for the team on Github - Integrated a Github plugin (TravisCI) to the team repo - Integrated a Github plugin (Appveyor) to the team repo - Integrated a Github plugin (Coveralls) to the team repo +*** Integrated a Github plugin (TravisCI) to the team repo +*** Integrated a Github plugin (Appveyor) to the team repo +*** Integrated a Github plugin (Coveralls) to the team repo == Contributions to the User Guide @@ -52,7 +53,7 @@ remove allergies from the existing list associated to a patient. |_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ |=== -include::../UserGuide.adoc[tag=addremall] +include::../UserGuide.adoc[tag=authentication] == Contributions to the Developer Guide @@ -60,4 +61,4 @@ include::../UserGuide.adoc[tag=addremall] |_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ |=== -_{to be added}_ +include::../DeveloperGuide.adoc[tag=authentication]