The program implements university access system, in fact, it is easily adjustable for your own needs.
By default program supports:
- 6 classes representing types of users
- 5 classes representing types of rooms
- 5 types of access levels
- Creating temporary guest account
- Emergency mode
Any of the abovementioned is easily expandable.
You will need to build the program from source code.
In order to run the program you need to provide two databases:
- User database (you can replace the default one named
database.txtconsisting of 60 users) - Room database (you can replace the default one named
room-database.txtconsisting of 47 rooms)
Make sure to follow the name convention and the structure:
-
For
database.txt:{ { name, occupation, subject, age, subjectYears }, { name, occupation, subject, age, subjectYears }, //... } -
For
room-database.txt:{ name, name, //... }
You should double check the correctness of your databases, then initialize them:
Users::initialize();
Rooms::initialize();Now the Access System is ready to use.
Primary methods that you will use have the following signatures:
class User {
public:
void goToRoom(Room* room);
virtual void allowUser(User* user, Room* room);
virtual void forbidUser(User* user, Room* room);
}Calls checkAccess(user, room) of AccessSystem passing current user as a user
Checks if the user is an admin and if it is, calls grantCustomAccess(user, room) of AccessSystem
Checks if the user is an admin and if it is, calls withdrawAccess(user, room) of AccessSystem
Abovementioned methods internally use methods of the AccessSystem class:
class AccessSystem {
bool logEnabled;
bool emergencyStatus;
AccessSystem();
public:
static AccessSystem sys;
void enableLog();
void disableLog();
void activateEmergency();
void deactivateEmergency();
bool checkAccess(User* user, Room* room);
bool grantCustomAccess(User* user, Room* room);
bool withdrawAccess(User* user, Room* room);
int createUserAccount();
};Enables log to admin's console
Disables log to admin's console
Activates emergency mode of the system
Deactivates emergency mode of the system
Checks permission of the user to open the room based on accessLevel of the room, accessibleLevel of the user, list of banned users from this room and users with custom access to this room (whitelist).
Adds user to whitelist and removes from banlist of a specific room.
Adds user to banlist and removes from whitelist of a specific room.
Starts the process of creating temporary user account in admin's console. Returns id of newly created account
This is not stable release of a program. You are running this program at your own risk.
Copyright © 2021. All rights reserved.