/*-------------------------------------------------------------------------------------------------------------- * Copyright (c) insite-gmbh. All rights reserved. * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------------------------*/ import { Injectable } from '@angular/core'; import { IUserAuthenticationService } from '../interfaces/IUserAuthenticationService.interface'; @Injectable() export class UserAuthenticationService implements IUserAuthenticationService { InvalidUserLevel: string = ""; authenticate(username: string, password: string): string { if (username === "admin" && password === "admin") { return "elevated" } else if (username === "user" && password === "user") { return "normal"; } return ""; } isSufficientLevel(currentUserLevel: string, neededUserLevel: string): boolean { return currentUserLevel === "elevated" || (currentUserLevel === neededUserLevel && currentUserLevel !== this.InvalidUserLevel); } }