Admin - BBKbeam/mtRooms GitHub Wiki
mtRooms.admin
The admin component provides all access and user administration for the application.

Component Interfaces
Return Objects
Token
mtRooms.admin.authentication.Token
Session generated token that holds a user's session ID, creation and expiry timestamp. Used to authenticate user requests in the application across layers.
ObjectTable
eadjlib.datastructure.ObjectTable
See Data Layer.
IAuthenticationSystem
mtRooms.admin.authentication.IAuthenticationSystem
Used to login/logout users and get session tokens. Also for checking current access rights against a minimum session type.
Token login(String username, String password) throws AuthenticationFailureException;
void logout(Token session_token) throws SessionInvalidException;
boolean hasValidAccessRights(Token session_token, SessionType user_session_type);
IAdminSession
mtRooms.admin.administration.IAdminSession
Used to manage user accounts for the application and do basic maintenance in the database. Requires a valid session Token to access.
void createNewAccount(Token admin_token, SessionType account_type, String username, String password) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException, AccountExistenceException, RuntimeException;
void updateAccountPassword(Token admin_token, Integer account_id, String password) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException, AccountExistenceException, AccountOverrideException, RuntimeException;
void activateAccount(Token admin_token, Integer account_id) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException, AccountExistenceException, AccountOverrideException, RuntimeException;
void deactivateAccount(Token admin_token, Integer account_id) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException, AccountExistenceException, AccountOverrideException, RuntimeException;
void deleteAccount(Token admin_token, Integer account_id) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException, AccountExistenceException, AccountOverrideException, RuntimeException;
ObjectTable getAccounts(Token admin_token) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException, RuntimeException;
ObjectTable getAccount(Token admin_token, Integer account_id) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException, RuntimeException;
ObjectTable getAccount(Token admin_token, String account_username) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException, RuntimeException;
boolean optimiseReservationDatabase(Token admin_token) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException;
boolean optimiseUserAccountDatabase(Token admin_token) throws SessionInvalidException, SessionExpiredException, SessionCorruptedException;
Exceptions thrown by layer
| Exception | Reason |
|---|---|
SessionInvalidException |
Session Token is invalid. |
SessionExpiredException |
Session Token is expired. |
SessionCorruptedException |
Session Token of same ID does not match the one created |
AccountExistenceException |
Account does not exist in the records |
AccountOverrideException |
Breaking edits to current logged-in administrator |
RuntimeException |
Non-standard failure during data fetching from records |
AuthenticationFailureException |
Invalid username and/or password |
Components
SessionIdGenerator
mtRooms.admin.authentication.SessionIdGenerator
Generates a random 32bit String.
UserAccountChecker
mtRooms.admin.authentication.UserAccountChecker
Takes care of all the user authentication side of admin. Implements IAuthenticationSystem.
ReservationDbMaintanance
mtRooms.admin.administration.ReservationDbMaintanance
Provides database 'vacuuming' methods for both the user account and reservation tables.
UserAccAdministration
Provides user account administration functionalities (add/get/modify/delete). Implements IAdminSession.
AdminSession
Provides transparency to the functionalities of IReservationDbMaintenance and UserAccAdministration with session token checking added to make sure only authorised administrators can access those functionalities.
Helper classes
PasswordHash
mtRooms.admin.authentication.PasswordHash
This class takes care of all the password hashing needs.
For creating a hashed password:
- A random salt is generated
- The salt and the password are combined and hashed.
Hashed password and their salts are then stored in the database records through the UserAccAdministration component.`
For checking a password is valid:
- The hashed password and salt are passed along with the password to check against.
- The password to check is hashed with the given salt.
- The result is then compared with the hashed password from the records.