Skip to content

Commit

Permalink
Merge pull request #107 from chuaes/master
Browse files Browse the repository at this point in the history
Update the dg to reflect the user authentication feature
  • Loading branch information
chuaes authored Apr 15, 2019
2 parents 3405865 + 1479091 commit f114d7d
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 19 deletions.
68 changes: 68 additions & 0 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added docs/diagrams/LoginSequenceDiagram.pptx
Binary file not shown.
Binary file added docs/images/LoginSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/RegisterSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 20 additions & 19 deletions docs/team/chuaes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,39 @@
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}_

* *Other contributions*:

** 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

Expand All @@ -52,12 +53,12 @@ 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

|===
|_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]

0 comments on commit f114d7d

Please sign in to comment.