add permissions to roles

This commit is contained in:
rubikscraft
2022-03-12 15:10:22 +01:00
parent 0aa897fa8d
commit b29b88d7b6
27 changed files with 601 additions and 230 deletions

View File

@@ -21,6 +21,8 @@ import { KeyService } from './key.service';
providedIn: 'root',
})
export class UserService {
private readonly logger = console;
public get liveUser() {
return this.userSubject;
}
@@ -79,7 +81,7 @@ export class UserService {
const user = await this.extractUser(apikey);
if (HasFailed(user)) {
console.warn(user.getReason());
this.logger.warn(user.getReason());
await this.logout();
return;
}
@@ -88,7 +90,7 @@ export class UserService {
const fetchedUser = await this.fetchUser();
if (HasFailed(fetchedUser)) {
console.warn(fetchedUser.getReason());
this.logger.warn(fetchedUser.getReason());
await this.logout();
return;
}
@@ -107,7 +109,7 @@ export class UserService {
const jwtData = plainToClass(JwtDataDto, decoded);
const errors = await validate(jwtData);
if (errors.length > 0) {
console.warn(errors);
this.logger.warn(errors);
return Fail('Invalid token data');
}