Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1.5][T11-B2] PrisonBook #78

Open
wants to merge 392 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
Show all changes
392 commits
Select commit Hold shift + click to select a range
9afa182
Add tests to test showcell and addcell (incomplete)
sarahgoh97 Mar 28, 2018
c29e014
Fixed coding standard errors
sarahgoh97 Mar 28, 2018
2fa38ea
Update to meet coding standards
sarahgoh97 Mar 28, 2018
9d95f29
Merge pull request #12 from CS2103JAN2018-T11-B2/master
philos22 Mar 28, 2018
98cfc71
Update documentation
sarahgoh97 Mar 28, 2018
3d1cb0b
Merge pull request #42 from sarahgoh97/cells
sarahgoh97 Mar 28, 2018
5e9ac91
added calendar command which lists all upcoming events - no tests yet
philos22 Mar 28, 2018
2cffb64
trying release
sarahgoh97 Mar 28, 2018
bba8a33
Merge pull request #5 from CS2103JAN2018-T11-B2/master
zacci Mar 28, 2018
8d063fa
style 1
philos22 Mar 28, 2018
c99afc7
style check fix
philos22 Mar 28, 2018
e3e14f1
veyor style fix
philos22 Mar 28, 2018
708f1db
Merge pull request #55 from philos22/master
philos22 Mar 28, 2018
a8e2c19
Merge pull request #11 from CS2103JAN2018-T11-B2/master
sarahgoh97 Mar 28, 2018
f18c20b
for release
sarahgoh97 Mar 28, 2018
343e076
Merge pull request #63 from sarahgoh97/master
sarahgoh97 Mar 28, 2018
08c0090
updated dev guide for calendar commands
philos22 Mar 29, 2018
f8ad4d9
updated dev guide for calendar commands - minor style changes
philos22 Mar 29, 2018
3b8a2ad
update calendar view command - dev guide user guide
philos22 Mar 29, 2018
141d2f7
update userguide minor details
philos22 Mar 29, 2018
bc6c4b0
Added Logout Command
zacci Mar 29, 2018
2ceed8c
Merge pull request #64 from zacci/master
zacci Mar 29, 2018
8acec84
[v1.3] Updated User Guide with Login and Logout Command
zacci Mar 29, 2018
c8065cd
Merge pull request #65 from zacci/master
zacci Mar 29, 2018
2a1d7eb
Updated Zacci Portfolio
zacci Mar 29, 2018
13f507c
Merge pull request #12 from CS2103JAN2018-T11-B2/master
sarahgoh97 Mar 29, 2018
64cb296
Merge pull request #66 from zacci/master
zacci Mar 29, 2018
21f692f
updated user portfolio and dev guide
philos22 Mar 29, 2018
fa198db
minor format details in portfolio
philos22 Mar 29, 2018
c6e860a
minor change in portfolio
philos22 Mar 29, 2018
dd79a22
Merge pull request #67 from philos22/master
philos22 Mar 29, 2018
a57f8f1
Merge pull request #13 from CS2103JAN2018-T11-B2/master
philos22 Apr 1, 2018
6269b5a
Merge pull request #13 from CS2103JAN2018-T11-B2/master
sarahgoh97 Apr 2, 2018
edf587c
Person removed from cell when deleted from list
sarahgoh97 Apr 2, 2018
2d096f1
Fixed addCell for undoing
sarahgoh97 Apr 2, 2018
ad764da
all tests passed
sarahgoh97 Apr 2, 2018
3b843ac
Merge pull request #6 from CS2103JAN2018-T11-B2/master
zacci Apr 2, 2018
aa12886
DeleteCellCommand with NotImprisonedException and PersonNotFoundExcep…
sarahgoh97 Apr 2, 2018
36b54f5
[v1.4] Implemented Sessions
zacci Apr 3, 2018
0ab0a88
Add Map to UI
sarahgoh97 Apr 3, 2018
ef444dd
Fix coding standards violations
sarahgoh97 Apr 4, 2018
ffaee13
Collate code
sarahgoh97 Apr 4, 2018
d0b828d
Changing GUI
sarahgoh97 Apr 4, 2018
ba74e9d
Update documentation
sarahgoh97 Apr 4, 2018
9d3208c
Include images
sarahgoh97 Apr 4, 2018
38b36f6
[v1.4] Implemented Minimum Security Logic
zacci Apr 4, 2018
bd34c90
Merge pull request #71 from sarahgoh97/tryDeleteAgain
zacci Apr 4, 2018
2303157
Merge branch 'master' into master
zacci Apr 4, 2018
3be5e78
Merge pull request #7 from CS2103JAN2018-T11-B2/master
zacci Apr 4, 2018
d77fa80
[v1.4] Fixed missing import for CheckStatusCommand
zacci Apr 4, 2018
e99c8fd
[v1.4] Fixing Travis and AppVeyor Errors
zacci Apr 4, 2018
984297c
[v1.4] Fixing Travis and AppVeyor Errors
zacci Apr 4, 2018
f0e6262
[v1.4] Fix Travis and AppVeyor Issues
zacci Apr 4, 2018
c626106
[v1.4] Fix Travis and AppVeyor Issues
zacci Apr 4, 2018
6409ee4
Calendar Add Event Functionality, Collated Author Docs
philos22 Apr 4, 2018
6030b17
Merge branch 'master' into master
philos22 Apr 4, 2018
f993dc7
Merge pull request #14 from CS2103JAN2018-T11-B2/master
philos22 Apr 4, 2018
45f126e
fix excluded import in addrBookParser
philos22 Apr 4, 2018
fbeb164
updated User Guide
philos22 Apr 4, 2018
4dc46f4
style fix 1
philos22 Apr 4, 2018
59e84e0
style fix 2
philos22 Apr 4, 2018
91a7a27
Documentation, addCalendarCommand
philos22 Apr 4, 2018
110336e
Merge branch 'master' into master
zacci Apr 4, 2018
f13d100
Merge pull request #73 from zacci/master
zacci Apr 4, 2018
7d43f89
[v1.4] Implemented Storage Capabilities for User Data & Added AddUser…
zacci Apr 4, 2018
ddead9e
Merge pull request #8 from CS2103JAN2018-T11-B2/master
zacci Apr 4, 2018
d682a78
Fix Merging Errors
zacci Apr 4, 2018
e3ea062
Merge branch 'master' of https://github.com/zacci/main
zacci Apr 4, 2018
1b812ed
[v1.4] Add Documentation and Fix Travis/AppVeyor Errors
zacci Apr 4, 2018
c664f3a
[v1.4] Fix CheckStyle Issues
zacci Apr 4, 2018
b24382e
[v1.4] Fix Checkstyle Errors
zacci Apr 4, 2018
64e93ac
style changes for v1.4
philos22 Apr 5, 2018
e02f12f
Merge pull request #76 from zacci/master
zacci Apr 5, 2018
a7ca816
update Version number in MainApp, fix calAdd error msg
philos22 Apr 5, 2018
1cdd6a5
Merge pull request #16 from CS2103JAN2018-T11-B2/master
philos22 Apr 5, 2018
a3726cd
Merge branch 'master' of https://github.com/philos22/main
philos22 Apr 5, 2018
616918a
Merge pull request #14 from CS2103JAN2018-T11-B2/master
sarahgoh97 Apr 5, 2018
22ed1a2
Collated files, authored for isaac
philos22 Apr 5, 2018
2c7f15b
Merge pull request #77 from philos22/master
philos22 Apr 5, 2018
0b7e41f
[v1.4] Update test code claiming
zacci Apr 5, 2018
e594d04
Merge pull request #78 from zacci/master
zacci Apr 5, 2018
dc844fa
Merge pull request #17 from CS2103JAN2018-T11-B2/master
philos22 Apr 5, 2018
dd06882
isaac collate
philos22 Apr 5, 2018
ea6240b
Merge pull request #79 from philos22/master
philos22 Apr 5, 2018
f49403a
Merge pull request #15 from CS2103JAN2018-T11-B2/master
sarahgoh97 Apr 6, 2018
5854788
[v1.4] Added Exceptions and Updated Userguide
zacci Apr 6, 2018
235ab21
Merge pull request #9 from CS2103JAN2018-T11-B2/master
zacci Apr 6, 2018
09830ed
Fix Checkstyle Errors
zacci Apr 6, 2018
6c58b69
Merge pull request #80 from zacci/master
zacci Apr 6, 2018
d322d11
Updated Userguide for Calendar Commands
zacci Apr 6, 2018
74e3264
Merge pull request #81 from zacci/master
zacci Apr 6, 2018
b7f2ded
change excetion message from prisoner in cell
sarahgoh97 Apr 6, 2018
1fa127e
Merge pull request #16 from CS2103JAN2018-T11-B2/master
sarahgoh97 Apr 9, 2018
df071d7
Merge branch 'master' of https://github.com/sarahgoh97/main into addc…
sarahgoh97 Apr 9, 2018
1154530
Fix delete undo bug (when deleting imprisoned prisoner)
sarahgoh97 Apr 9, 2018
68ecc49
Update GUI to not show anything when first opening app
sarahgoh97 Apr 10, 2018
e265e74
Updated tests and collating comments
sarahgoh97 Apr 10, 2018
0d6e2dd
Remove SelectCommand and changed affected tests
sarahgoh97 Apr 10, 2018
d0a2bc8
Updated user guide
sarahgoh97 Apr 10, 2018
d3a1318
Fix undo bugs for deleteCell
sarahgoh97 Apr 10, 2018
da253fd
Collate comments added
sarahgoh97 Apr 10, 2018
5bb8397
Update UG for cell limits
sarahgoh97 Apr 10, 2018
e9007b1
Implement ListCell function for CLI
sarahgoh97 Apr 10, 2018
8289522
Fixed UserGuide for cal command
sarahgoh97 Apr 11, 2018
f721e77
Merge pull request #10 from CS2103JAN2018-T11-B2/master
zacci Apr 11, 2018
fe85204
Removed Clear Command and Handled Login/Logout exceptions
zacci Apr 11, 2018
69baa6b
fix bug for DC command
sarahgoh97 Apr 11, 2018
773f915
Delete DeveloperGuide.adoc.orig
philos22 Apr 11, 2018
8ff1879
[v1.5] Added Delete User Functionality
zacci Apr 11, 2018
c0caba0
Merge pull request #114 from sarahgoh97/addcellfixes
zacci Apr 11, 2018
d1f8aaa
Merge pull request #11 from CS2103JAN2018-T11-B2/master
zacci Apr 11, 2018
ba4972d
Added Implementation to ModelStub
zacci Apr 11, 2018
63e3a23
Merge branch 'master' of https://github.com/zacci/main
zacci Apr 11, 2018
862e6c0
Fixed Test Issues
zacci Apr 11, 2018
0372b7d
Calendar DeleteEvent command implemented, documentation updated
philos22 Apr 11, 2018
7a959d4
Merge branch 'master' into master
philos22 Apr 11, 2018
0ae694c
Merge pull request #18 from CS2103JAN2018-T11-B2/master
philos22 Apr 11, 2018
e5131d5
Fix Checkstyle Errors
zacci Apr 11, 2018
ac651c9
user guide update for calDel
philos22 Apr 11, 2018
254ebef
calDelete documentation
philos22 Apr 11, 2018
9de2b6d
style fix 1
philos22 Apr 11, 2018
35cd8a1
style fix 2
philos22 Apr 11, 2018
4a3a552
Updated UserGuide and Changed Role on UI
zacci Apr 11, 2018
a2dcc68
style fix 3
philos22 Apr 11, 2018
cc6e7eb
Merge pull request #118 from philos22/master
philos22 Apr 11, 2018
09825c0
portfolio fix
philos22 Apr 11, 2018
d2fac0e
Merge pull request #120 from philos22/master
philos22 Apr 11, 2018
21d332d
portfolio fix2
philos22 Apr 11, 2018
7619f42
portfolio fix2
philos22 Apr 11, 2018
dfc99e6
portfolio fix3
philos22 Apr 11, 2018
60d8d1b
Merge pull request #121 from philos22/master
philos22 Apr 11, 2018
09bbe67
portfolio fix 4
philos22 Apr 11, 2018
d6545bb
Merge pull request #122 from philos22/master
philos22 Apr 11, 2018
6256802
Merge pull request #17 from CS2103JAN2018-T11-B2/master
sarahgoh97 Apr 11, 2018
08e7a94
Update user guide
sarahgoh97 Apr 11, 2018
2f8a62b
Fixed Setup for AddCellCommandTest and EditCommandTest and pass tests
sarahgoh97 Apr 11, 2018
119eb4f
Update documentation
sarahgoh97 Apr 11, 2018
f63b0f0
Merge branch 'addcellfixes' to master
sarahgoh97 Apr 11, 2018
8379219
Merge pull request #123 from sarahgoh97/master
sarahgoh97 Apr 11, 2018
ac2a912
Set maximum of 15 digits for Phone
sarahgoh97 Apr 11, 2018
b8926ec
Prevent users from changing roles and cell addresses of persons in pr…
sarahgoh97 Apr 11, 2018
6de5259
Merge pull request #12 from CS2103JAN2018-T11-B2/master
zacci Apr 11, 2018
ffd23d8
Fix Checkstyle Errors
zacci Apr 11, 2018
439149c
portfolio added
philos22 Apr 11, 2018
56e4c37
Merge pull request #19 from CS2103JAN2018-T11-B2/master
philos22 Apr 11, 2018
b397072
Merge pull request #124 from philos22/master
philos22 Apr 11, 2018
146fd1b
Fix Checkstyle Errors
zacci Apr 11, 2018
0072452
Merge pull request #119 from zacci/master
zacci Apr 11, 2018
8926d74
Cannot edit roles and editting addresses only change old address of i…
sarahgoh97 Apr 11, 2018
2718b9c
Merge pull request #18 from CS2103JAN2018-T11-B2/master
sarahgoh97 Apr 11, 2018
3717bc7
Update developerguide
sarahgoh97 Apr 11, 2018
4eb0138
Merge and update UserGuide
sarahgoh97 Apr 11, 2018
06f8207
Merge pull request #125 from sarahgoh97/master
sarahgoh97 Apr 11, 2018
dfeb051
Show list when logged in and hide map and list when logged out
sarahgoh97 Apr 11, 2018
606d3bd
Merge pull request #127 from sarahgoh97/master
sarahgoh97 Apr 11, 2018
29fec28
Collated
sarahgoh97 Apr 12, 2018
fe03f87
Merge pull request #20 from CS2103JAN2018-T11-B2/master
philos22 Apr 12, 2018
17ad347
updated collated code
philos22 Apr 12, 2018
a7e51b9
Added sample prisoner and guards details in Sample Data Util
zacci Apr 12, 2018
b2428f7
Updated UserGuide
zacci Apr 12, 2018
d55cb2d
Added minsecuritylevel to Deleteusercommand
zacci Apr 12, 2018
75ad24f
Merge branch 'master' into master
zacci Apr 12, 2018
e916fba
Updated user guide
zacci Apr 12, 2018
eab26b2
Merge pull request #13 from CS2103JAN2018-T11-B2/master
zacci Apr 12, 2018
e2b7211
fix deletecommand arraylist bug
philos22 Apr 12, 2018
3e36a29
Fix CheckStyle Errors
zacci Apr 12, 2018
b88f96f
Merge branch 'master' of https://github.com/zacci/main
zacci Apr 12, 2018
9a8ef7a
Fixing Errors
zacci Apr 12, 2018
fffc0a5
Merge pull request #129 from zacci/master
zacci Apr 12, 2018
399699f
update scope of example command
philos22 Apr 12, 2018
3760e18
Merge pull request #130 from philos22/master
zacci Apr 12, 2018
62b61c0
Merge pull request #14 from CS2103JAN2018-T11-B2/master
zacci Apr 12, 2018
0307782
Merge pull request #21 from CS2103JAN2018-T11-B2/master
philos22 Apr 12, 2018
9081774
fix timezone bug and displayed event details
philos22 Apr 12, 2018
3deac39
style fix
philos22 Apr 12, 2018
cf96172
[v1.5] Fix Timezone Bug and Displayed Event Details
philos22 Apr 12, 2018
796be0e
Merge branch 'master' into master
sarahgoh97 Apr 13, 2018
9344f06
Merge pull request #19 from CS2103JAN2018-T11-B2/master
sarahgoh97 Apr 13, 2018
5ccb191
Finished addCellCommandTests
sarahgoh97 Apr 13, 2018
9ea4140
add UndoRedo test for addcell
sarahgoh97 Apr 13, 2018
703214d
Finished tests for DeleteCellCommand
sarahgoh97 Apr 13, 2018
05bc685
Refactored and pass all tests
sarahgoh97 Apr 13, 2018
4e176f6
Add ListCellTest and ensure passing of all tests
sarahgoh97 Apr 13, 2018
a5b620f
Tests for cells added
sarahgoh97 Apr 13, 2018
cad12ee
Update Documentation
sarahgoh97 Apr 13, 2018
aa7affb
Fix EditCommand bug
sarahgoh97 Apr 13, 2018
67534d6
Add imprisoned prisoners to sampleFile
sarahgoh97 Apr 13, 2018
01e795a
Collated some code
sarahgoh97 Apr 13, 2018
80350b6
Fix another EditCommand bug
sarahgoh97 Apr 13, 2018
cda0e08
Refactored some code
sarahgoh97 Apr 13, 2018
b1aeb46
Update documentation
sarahgoh97 Apr 14, 2018
f3c86a3
Merge pull request #133 from sarahgoh97/cellTests
sarahgoh97 Apr 14, 2018
67e7e6e
Update portfolio
sarahgoh97 Apr 14, 2018
a4ddfab
Updated Portfolio
sarahgoh97 Apr 14, 2018
c175d9f
Fix typing errors and documentation
sarahgoh97 Apr 14, 2018
2dc2c5e
Fix typing errors and documentation
sarahgoh97 Apr 14, 2018
376db96
Added portfolio and editted userguide
sarahgoh97 Apr 14, 2018
df2fa7c
Added portfolio and updated UserGuide
sarahgoh97 Apr 14, 2018
0f7b5d5
Write more comments
sarahgoh97 Apr 14, 2018
e861b44
Update DG
sarahgoh97 Apr 14, 2018
e8e54f6
Update DeveloperGuide and Version on MainApp
sarahgoh97 Apr 14, 2018
3c525ca
Edit Command summary
sarahgoh97 Apr 14, 2018
8830618
Merge pull request #22 from CS2103JAN2018-T11-B2/master
philos22 Apr 15, 2018
b283ca4
Merge pull request #15 from CS2103JAN2018-T11-B2/master
zacci Apr 15, 2018
6157861
Added AddUserCommand Tests + UserTest Utils
zacci Apr 15, 2018
4531761
Added Login Command Tests and Logout Command Tests
zacci Apr 15, 2018
28b4bd3
Added DeleteUserCommand Tests
zacci Apr 15, 2018
d479ae6
Fix Exception Checkstyle Issues
zacci Apr 15, 2018
8514580
Fix Checkstyle Issues
zacci Apr 15, 2018
b90ffc1
Checkstyle Errors
zacci Apr 15, 2018
ea5909b
Merge pull request #138 from zacci/master
zacci Apr 15, 2018
391e151
Added manual testing guide
zacci Apr 15, 2018
006fa5d
Update StatusBarFooter when logged out
sarahgoh97 Apr 15, 2018
369d0d6
Updated Dev Guide
zacci Apr 15, 2018
b05b71e
Corrected Typo
zacci Apr 15, 2018
d01822a
Updated Zacci Portfolio
zacci Apr 15, 2018
53a5fa6
Merge pull request #139 from zacci/master
zacci Apr 15, 2018
c13e882
Tagged some code for collation
zacci Apr 15, 2018
2a43520
Merge pull request #23 from CS2103JAN2018-T11-B2/master
philos22 Apr 15, 2018
48733cb
Merge pull request #140 from zacci/master
zacci Apr 15, 2018
014b2e9
Updated Zacci Portfolio
zacci Apr 15, 2018
d095166
Update StatusBar and UserGuide
sarahgoh97 Apr 15, 2018
d67046c
Updated zacci portfolio
zacci Apr 15, 2018
bf20fa0
Merge pull request #142 from zacci/master
zacci Apr 15, 2018
9c4b054
Merge pull request #143 from zacci/master
zacci Apr 15, 2018
e61bd45
docs, calAddCommandParser changes, find by tags parser changes
philos22 Apr 15, 2018
239a3b6
dev guide manual testing
philos22 Apr 15, 2018
18c02cd
dev guide image load
philos22 Apr 15, 2018
c8772a7
bug fixes
philos22 Apr 15, 2018
26817a5
Merge pull request #144 from philos22/master
philos22 Apr 15, 2018
650c8f2
fix calD bug and message
philos22 Apr 15, 2018
6b2e2f6
collate
philos22 Apr 15, 2018
0c83e08
portfolio
philos22 Apr 15, 2018
ab1e30e
port
philos22 Apr 15, 2018
3f1b6dc
styles 1
philos22 Apr 15, 2018
1f7ab62
styles2
philos22 Apr 15, 2018
fec35af
styles3
philos22 Apr 15, 2018
ed07030
style 4 - collate
philos22 Apr 15, 2018
c79f4ce
style 5
philos22 Apr 15, 2018
d1b6e8e
[v1.5] Documentation and Bug fixes
sarahgoh97 Apr 15, 2018
8f33ca1
style
philos22 Apr 15, 2018
78104d6
Merge pull request #147 from philos22/master
philos22 Apr 15, 2018
bb1b46d
portfolio minimize
philos22 Apr 15, 2018
c5d17fa
Merge pull request #148 from philos22/master
philos22 Apr 15, 2018
db415b8
img
philos22 Apr 15, 2018
4100da2
img
philos22 Apr 15, 2018
e0382f9
Merge pull request #149 from philos22/master
philos22 Apr 15, 2018
40fa13f
mini
philos22 Apr 15, 2018
cd4d544
mini
philos22 Apr 15, 2018
d673dd2
Merge pull request #150 from philos22/master
philos22 Apr 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 126 additions & 13 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
@@ -364,21 +364,70 @@ image::UndoRedoActivityDiagram.png[width="650"]
//tag::loginsecurity[]
=== Login and Security Feature
==== Current Implementation
===== Model Aspect

The implementation of the Login and Security feature is implemented by a `Session` which resides inside `Model Manager`. It supports the logging in and logging out of a user as well as support restricted access for specific commands. For example read access (list command) vs write access (add command and edit command).
The Login and Security feature in the PrisonBook is implemented using Users and Sessions.

image::ModelClassDiagramwSession.jpg[width="800"]
===== Sessions
Sessions are implemented with a `Session` class which resides inside `Model Manager`. It supports the logging in and logging out of a user as well as support restricted access for specific commands. For example read access (list command) vs write access (add command and edit command).

As can be seen from the diagram, a Session is initialised upon the creation of the ModelManager.
image::ModelClassDiagramwSessionwCells.png[width="800"]

===== Logic Aspect
As can be seen from the diagram, a Session is initialised upon the creation of the ModelManager. The session stores information such as the logged-in user's username, as well as the security level of the user.

The implementation of the logging-in and the security levels is implemented in the `SessionManager` which is an additional step between the `LogicManager` and the `AddressBookParser`.
The accessibility of each command by the user is implemented on the logic level. Each command has a static `minimumSecurityLevel`. The usage of a command goes through the sequence diagram as follows (the example command being used here is the Delete command).

image::SecurityLevelSequenceDiagram.png[width="800"]

The `LogicManager` checks the `minSecurityLevel` of the command against the `securityLevel` of the current `Session` in the Model. If `the securityLevel` greater than or equal to the `minSecurityLevel`, the LogicManager will then call the `execute()` method on the Command.

===== Design Considerations

====== Aspect: Implementation for checking of security level for command access
* **Alternative 1 (current choice):** Implemented by the `LogicManager`
** Pros: Decreases coupling between `Command` and `Session`. This allows for flexibility in future implementation changes.
** Cons: Sequence during execution needs to go back and forth with the `LogicManager`
* **Alternative 2:** Implement at the `Command` level
** Pros: Easy to understand, the sequence during execution keeps moving on to the next step instead of going back and forth with the LogicManager.
** Cons: Commands are also responsible for checking if they should be run. Violates Single Responsibility Principle and Separation of Concerns as `HistoryManager` now needs to do two different things.


===== Users
Users are implemented with a `User` class, as well as a `UniqueUserMap` class which also reside in the `Model Manager`. +
The `UniqueUserMap` is implemented using a Hashmap which maps `usernames` as Keys and `User` as Values. Additionally, there is an internal list implemented via an `ObservableList` of all the Users in the Hashmap.

To save the database of the users, a new type is added to the storage so that it is able to store the Users in the storage file.

image::StorageClassDiagramwUserwCells.png[width="800"]

Upon initialization of the AddressBook, the AddressBook will read the user data from the storage file and create the internal list of Users. The list is then iterated through and mapped to the HashMap.

When adding and deleting users, both the Hashmap and the internal list are updated so as to reflect accurately in the model and stored correctly in the storage.

Currently, the user data, including passwords are stored in plaintext, which may pose a security problem. For future implementations, we will include hashing of the passwords before storage to as to increase the security of the application.


===== Design Considerations

====== Aspect: Data Structures for UniqueUserMap
* **Alternative 1 (current choice):** Hashmap + ObservableList
** Pros: Easy to access users, can immediately call up the correct `User` object by passing in the username key. Whereas the ObservableList is used to complement the storage of the user data, where it is necessary to iterate through all the Users in order to store in the storage .xml file.
** Cons: Duplicate information stored in two different data structures.
* **Alternative 2:** ObservableList only
** Pros: No duplication of Users. Storing is also easy as it uses the existing AddressBook storage framework which works with ObservableLists.
** Cons: Everytime we want to access a specific User, we have to iterate through the entire list of Users in order to do so.
* **Alternative 3:** HashMap only
** Pros: Fast access of users in O(1) time
** Cons: Unable to be stored efficiently with the current method of storing which works with XML file.

====== Aspect: Storage location of User Data
* **Alternative 1 (current choice):** Stored in the same XML File with the AddressBook data
** Pros: Easy to implement with current method of saving, where the entire AddressBook is upon an Address Book Changed Event. There is no need to maintain an additional stack for a User Database for UndoRedo.
** Cons: User data should theoretically be separated from AddressBook data (persons, cells, tags).
* **Alternative 2:** Store in a separate XML File
** Pros: Separation of storage for two different aspects. If User data file is corrupted, it does not affect the AddressBook data and vice versa.
** Cons: Very difficult to implement with the current method of saving. Furthermore, there needs to be addtional stacks implemented to keep track of the past states of User data for the UndoRedo functions.

image::LogicClassDiagramwSession.png[width="800"]

Every user input will first go through the `SessionManager` which will check if the user is currently logged in, as well as retrieve the user's security level. It will then pass the security level to the `AddressBookParser` which will then decide whether or not to create the Command based on the required security level of the entered command.
//end::loginsecurity[]

// tag::cellmap[]
@@ -394,12 +443,12 @@ However, to prevent accidental changes, a read-only version of the cells are ret
Since this is part of the `Model` component of the PrisonBook, the `Model` component has been updated accordingly as shown below.
At the bottom of the `Model` class diagram, it has been updated to show how the cell system is linked to the other components.

image::ModelClassDiagram.png[Width="550"]
image::ModelClassDiagramwSessionwCells.png[Width="550"]

To save and load the data of the cell system, storage also played an important component to ensure no data is lost when closing the app.
Below is a class diagram of `Storage` to show how the cells are saved. A new type is added to the storage so that it knows how to save and load data for cells.

image::StorageClassDiagram.png[Width="550"]
image::StorageClassDiagramwUserwCells.png[Width="550"]

This map is shown on the user interface on the right side area, shown in the picture below.
Since the app is still being tested, the `map` command will also show the actual cells in the result display box.
@@ -998,10 +1047,71 @@ These instructions only provide a starting point for testers to work on; testers
.. Re-launch the app by double-clicking the jar file. +
Expected: The most recent window size and location is retained.

// tag::philostest[]
// end::philostest[]

// tag::isaactest[]

=== Major Feature: Users, Sessions and Security Levels
==== Logging in and Logging out
. For security purposes, users of PrisonBook need to login with their user details in order to to view the information on the PrisonBook. They can also logout after finishing their session, so that the next person will need to login again.

.. Prerequisites: You must not be logged in. (By default, you are not logged in when you first open the application.) +
Test case: Type `login user/prisonguard pw/password1` +
Expected: PrisonBook will display `Login Success`

.. Prerequisites: You are logged in. +
Test case: Type `status` to show your current session's details +
Expected: `Username: prisonguard Security Level: 1`

.. Prerequisites: You are logged in. +
Test case: Type `logout` to logout +
Expected: PrisonBook will display `Successfully logged out`. Furthermore the person details in the left panel will be cleared, and the cell details in the right panel will reflect that you have insufficient authority to view the information.

==== Commands have restricted access
. A minimum Security Level is required to use and access certain commands. +
Refer to Section 5: Command Summary for the detailed list of commands and their respective minimum security level ranging from 0 to 3.

.. Test case: Type `logout` to ensure that you are logged out. (By default you are not logged in when you first open the application) +
Type `list` +
Expected: PrisonBook will show `Your security level is insufficient to access this command.` +
.. Test case: Login using `login user/prisonleader pw/password2` (This user has Security Level of 2) +
Type `list` +
Expected: PrisonBook will say `Listed all persons` and show the full list of persons on the left column of the UI. +
You can test the other commands with the following user details:
... `login user/prisonwarden pw/password3` Security Level 3.
... `login user/prisonleader pw/password2` Security Level 2.
... `login user/prisonguard pw/password1` Security Level 1.

==== Adding a new user
. You can add new users to the PrisonBook when you want to give access to new people.

.. Prerequisites: Have sufficient security level[3] +
Test case: `adduser user/prisonguard99 pw/password2 sl/1` +
Expected: `New user prisonguard99 added to PrisonBook` +
You can then proceed to logout and attempt to login with the new user `prisonguard99`.

.. Prerequisites: Have sufficient security level[3] +
Test case: `adduser user/prisonwarden pw/password3 sl/3` +
Expected: `prisonwarden is already a user in PrisonBook` +

==== Deleting a user
. You can delete users from the PrisonBook

.. Prerequisites: You must be logged in with a higher security level than the user you want to delete. (Users with security level 3 can delete anyone, including other security level 3 users.) +
Test case: Login with `login user/prisonleader pw/password2`, then type `deleteuser user/prisonguard99` (Which was added above in F.2.3) +
Expected: `User has been successfully deleted`. You can logout and attempt to login to `prisonguard99` but you will not be able to successfully login as the user has been deleted.

.. Prerequisites: You must be logged in with a minimum security level of 2. +
Test case: `delete user/nonexistentuser`
Expected: `The username does not exist`

=== Minor Feature: Role Attribute added to Persons
. Allow user to indicate to the PrisonBook if added person is a Guard or a Prisoner.

.. Prerequisites: Have sufficient security level[2]
.. Test case: `add n/Sample Prisoner a/Chua Chu Kang p/91234567 e/sp@example.com r/p` +
Expected: New person to show up on the UI with the name Sample Prisoner and shown to be a Prisoner on the person card.
.. Test case: `add n/Sample Guard a/Chua Chu Kang p/91234567 e/sg@example.com r/g` +
Expected: New person to show up on the UI with the name Sample Guard and shown to be a Guard on the person card.

// end::isaactest[]

// tag::sarahtest[]
@@ -1059,6 +1169,9 @@ These instructions only provide a starting point for testers to work on; testers

// end::sarahtest[]

// tag::philostest[]
// end::philostest[]

=== Saving data

. Dealing with missing/corrupted data files
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/diagrams/StorageComponentClassDiagram.pptx
Binary file not shown.
Binary file added docs/images/ModelClassDiagramwSessionwCells.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/SecurityLevelSequenceDiagram.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/StorageClassDiagramwUserwCells.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.