Skip to content

Commit

Permalink
Merge 393ded3 into cb3c241
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyao-lee committed Oct 17, 2018
2 parents cb3c241 + 393ded3 commit 3cfd94f
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 101 deletions.
84 changes: 59 additions & 25 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:warning-caption: :warning:
:sourcedir: src/main/java
endif::[]
:repoURL: https://github.com/se-edu/addressbook-level4/tree/master
:repoURL: https://github.com/CS2113-AY1819S1-T16-3/main/tree/master/

By: `T16-3`      Since: `Aug 2018`      Licence: `MIT`

Expand Down Expand Up @@ -127,6 +128,7 @@ The rest of the App consists of four components.
* <<Design-Logic,*`Logic`*>>: The command executor.
* <<Design-Model,*`Model`*>>: Holds the data of the App in-memory.
* <<Design-Storage,*`Storage`*>>: Reads data from, and writes data to, the hard disk.
* <<Session, *`Session`*>>: Stores the data of the user who is logged in to the application during runtime.

Each of the four components

Expand Down Expand Up @@ -230,6 +232,17 @@ The `Storage` component,
* can save `UserPref` objects in json format and read it back.
* can save the Address Book data in xml format and read it back.

[[Design-Session]]
=== Session component

*API* : link:{repoURL}/src/main/java/seedu/address/model/SessionManager.java[`SessionManager.java`]

The `Session` component,

* stores the identity of the user who is logged in to the app during runtime.
* allows other functions that require elevated user status, to inquire from `SessionManager` as to whether the user
is logged in, and also to inquire if the user has sufficient level of access to execute that particular function.

[[Design-Commons]]
=== Common classes

Expand Down Expand Up @@ -445,12 +458,39 @@ The sequence diagram below demonstrates the interaction within the `Logic` compo
image::FilterDepartmentCommandSequenceDiagram.png[width="800"]
// end::filterdepartment[]

// tag::dataencryption[]
=== [Proposed] Data Encryption
// tag::priorityLevel[]
=== Priority level restriction feature
All employee accounts contain a priority level field. Depending on the priority level that they are given, administrative
operations may be executed if they have sufficient priority level required to do so.

==== Implementation
Here is a code snippet of executing the AddCommand function. In this example, adding a person requires a person to be
logged in with a priority level of ADMINISTRATOR or above, in order to execute this function: -

.AddCommand.java
[source,java]
----
public CommandResult execute(Model model, CommandHistory history) throws CommandException {
requireNonNull(model);
_{Explain here how the data encryption feature will be implemented}_
if (!SessionManager.isLoggedIn()) { //<1>
throw new CommandException(SessionManager.NOT_LOGGED_IN);
}
/**
* Throws exception if user does not have the required access level.
*/
if (!SessionManager.hasSufficientPriorityLevelForThisSession(PriorityLevelEnum.ADMINISTRATOR)) { //<2>
throw new CommandException(String.format(PriorityLevel.INSUFFICIENT_PRIORITY_LEVEL,
PriorityLevelEnum.ADMINISTRATOR));
}
...
... //Execute the rest of the code only when both checks above have passed.
}
----
<1> Check if the user is logged in.
<2> Check if the logged in user has a priority level of ADMINISTRATOR and above.

// end::dataencryption[]
// end:priorityLevel[]

=== Logging

Expand Down Expand Up @@ -1120,38 +1160,32 @@ Use case ends.
=== Use case: Change priority level of user
*MSS*

. User enters superuser command
. AddressBook prompts password
. User enters password
. AddressBook prompts user for ‘superuser’ command
. User enters priority level command
. AddressBook prompts user for employee name and new priority level
. User enters both employee name and new priority level
. AddressBook updates the changes
. User enters `setplvl INDEX plvl/PRIORITY_LEVEL`
. AddressBook updates the priority level of the person at stated index.
+
Use case ends.

*Extensions*

* 4a. Incorrect password
** 4a1. AddressBook shows an error message.
* 2a. User is not logged in
** 2a1. AddressBook shows an error message.
+
Use case resumes to step 2.
Use case ends.

* 6a. No such command
** 6a1. AddressBook shows an error message.
* 2b. Invalid priority level
** 2b1. AddressBook shows an error message.
+
Use case resumes to step 4.
Use case ends.

* 8a. No such employee found
** 8a1. AddressBook shows an error message.
* 2c. User logged in, but insufficient priority level
** 2c1. AddressBook shows an error message.
+
Use case resumes to step 6.
Use case ends.

* 8b. No such priority level
** 8b1. AddressBook shows an error message.
* 2d. User logged in, sufficient priority level, but tries to edit his/her own priority level
** 2d1. AddressBook shows an error message.
+
Use case resumes to step 6.
Use case ends.

=== Use case: Edit personal particulars
*MSS*
Expand Down
79 changes: 3 additions & 76 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Examples:
====
Returns a list of employees who are in `Junior Management`.
====
* `filterdepartment junior senior`
* `fd junior senior`
====
Returns a list of employees who are in `Junior Management` and `Senior Management`.
====
Expand All @@ -199,7 +199,7 @@ This operation requires administrator priviledge to perform.
====

Deletes the specified person from the address book. +
Format: `delete INDEX [MORE_INDEX]...`
Format: `delete INDEX`

****
* Deletes the person at the specified `INDEX`.
Expand Down Expand Up @@ -234,75 +234,6 @@ Selects the 2nd person in the address book.
`select 1` +
Selects the 1st person in the results of the `find` command.

=== Add Leave application : `leave`

Add leave application of the user for approval.

Format: `leave date/DATE`

[NOTE]
====
* Requires the user to log in before using the command.
* DATE must be in the format DD/MM/YYYY
====

Example: `leave date/20/03/2019`
====
Request leave application on 20/03/2019.
====

=== List Leave application : `listleave`

List out all leave application in the leave list.

Format: `listleave`

=== Filter Leave application : `filterleave`

Filter leave applications based on NRIC.

Format: `filterleave NRIC`

Alias: `fl NRIC`

[NOTE]
====
* Filter is case insensative eg. `s1234567a` matches `S1234567A`
====

Example:
`fl S1213452A`

====
* List all leave application requested by the user with NRIC, 'S1213452A'.
====

=== Delete Leave application : `deleteleave`

Delete the specified leave from leave list.

[NOTE]
====
* Requires the user to log in before using the command.
* User can only delete leave application he/she requested.
* To delete other user's application, requires adminstrator priviledge to perform.
====

Format: `deleteleave INDEX`

****
* Deletes the leave at the specified `INDEX`.
* The index refers to the index number shown in the displayed leave list.
* The index *must be a positive integer* 1, 2, 3, ...
****

Example:
`deleteleave 2`

****
* Deletes the leave applicarion with ID 2 in the leave list.
****

=== Listing entered commands : `history`

Lists all the commands that you have entered in reverse chronological order. +
Expand Down Expand Up @@ -517,11 +448,7 @@ _{explain how the user can enable/disable data encryption}_
• *Sort address book contacts*: `sort name asc`
• *Filter departments*: `filterdepartment junior`
• *Deleting employee*: `delete INDEX [MORE_INDEX]`
• *Change priority level of employee*: `setplvl ic/NRIC plvl/LEVEL`
• *Add leave application*: `leave date/DATE`
• *List all leave applications*: `listleave`
• *Filter leave applications*: `filterleave NRIC`
• *Delete leave application*: `deleteleave INDEX`
• *Change priority level of employee*: `setplvl ic/NRIC plvl//LEVEL`
//• *Restrict access to BankAB*: `restrict`

== Appendix A: List of prefixes in the application
Expand Down
Binary file modified docs/diagrams/ArchitectureDiagram.pptx
Binary file not shown.
Binary file modified docs/diagrams/LogicComponentSequenceDiagram.pptx
Binary file not shown.
Binary file modified docs/diagrams/ModelComponentClassDiagram.pptx
Binary file not shown.
Binary file modified docs/images/Architecture.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 modified docs/images/DeletePersonSdForLogic.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 modified docs/images/ModelClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3cfd94f

Please sign in to comment.