Skip to content
Snippets Groups Projects
Commit 81a65c52 authored by michael.minelli's avatar michael.minelli
Browse files

User => Add teaching permissions test

parent 9be7c7bf
Branches
No related tags found
No related merge requests found
......@@ -12,6 +12,10 @@ class Config {
public readonly jwtSecretKey: string;
public readonly sessionTimeout: number;
public permissions: {
teachingStaff: Array<string>;
};
public readonly userPasswordLength: number;
public readonly userPasswordSaltRounds: number;
......@@ -32,6 +36,10 @@ class Config {
this.jwtSecretKey = process.env.JWT_SECRET_KEY;
this.sessionTimeout = Number(process.env.SESSION_TIMEOUT);
this.permissions = {
teachingStaff: JSON.parse(process.env.ROLES_WITH_TEACHING_STAFF_PERMISSIONS)
};
this.userPasswordLength = Number(process.env.USER_PASSWORD_LENGTH);
this.userPasswordSaltRounds = Number(process.env.USER_PASSWORD_SALT_ROUNDS);
}
......
......@@ -29,6 +29,7 @@ class User extends Model {
'lastName' : this.userLastName,
'mail' : this.userMail,
'role' : this.userRole,
'isTeachingStaff': this.isTeachingStaff,
'deleted' : this.userDeleted
};
......@@ -39,6 +40,10 @@ class User extends Model {
return this.userLastName.toUpperCase() + ' ' + this.userFirstName;
}
get isTeachingStaff(): boolean {
return Config.permissions.teachingStaff.includes(this.userRole);
}
public importFromJsonObject(jsonObject: any) {
this.userID = jsonObject.id;
this.userFirstName = jsonObject.firstName;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment