I'm looking for a solution to solve the following issue. I need to access a property that will store data from an http request. Therefore, I want to verify this property only after the transaction is completed.
validateAuthorization(path: string): boolean{
const currentUser: UserStorage = this.storage.getCurrentUser();
let user: User
this.userService.findUserByLogin(currentUser.login).subscribe(
data => {
user = data
}
)
if (user.profile.springSecurity == 'ROLE_ADMIN'){
return true;
} else {
const message: Message = {message: 'User does not have permission', type: MessageType.ERROR}
this.message.notify(message)
return false;
}
}