fix to accept login of user that does not have access to Chat

This commit is contained in:
tiago.kayaya
2022-04-05 17:10:23 +01:00
parent 465ea5d7c6
commit 019c7c43aa
4 changed files with 41 additions and 13 deletions
+21 -9
View File
@@ -44,7 +44,7 @@ export class LoginPage implements OnInit {
private changeProfileService: ChangeProfileService,
public ThemeService: ThemeService,
private storageservice: StorageService,
public permissionService: PermissionService,
public p: PermissionService,
) {}
ngOnInit() {
@@ -104,11 +104,20 @@ export class LoginPage implements OnInit {
// login to API successfully
if (attempt) {
if (attempt.UserId == SessionStore.user.UserId) {
await this.authService.SetSession(attempt, this.userattempt);
await this.authService.loginChat();
await this.authService.loginToChatWs();
console.log(this.p.userPermission(this.permissionList.Chat.access));
if(this.p.userPermission(this.permissionList.Chat.access)){
alert('RC IN')
await this.authService.loginChat();
await this.authService.loginToChatWs();
}
this.getToken();
SessionStore.setInativity(true);
@@ -123,8 +132,12 @@ export class LoginPage implements OnInit {
await this.authService.SetSession(attempt, this.userattempt);
this.changeProfileService.run();
await this.authService.loginChat();
await this.authService.loginToChatWs();
if(this.p.userPermission(this.permissionList.Chat.access)){
await this.authService.loginChat();
await this.authService.loginToChatWs();
}
this.getToken();
this.router.navigateByUrl('/pin', { replaceUrl: true });
@@ -148,14 +161,13 @@ export class LoginPage implements OnInit {
if(pathName) {
this.router.navigate([pathName]);
} else {
if(this.permissionService.userPermission(this.permissionList.Agenda.access) || this.permissionService.userPermission(this.permissionList.Gabinete.access)){
if(this.p.userPermission(this.permissionList.Agenda.access) || this.p.userPermission(this.permissionList.Gabinete.access)){
this.router.navigate(['/home/events']);
}
else if(this.permissionService.userPermission(this.permissionList.Chat.access) && this.permissionService.userPermission(this.permissionList.Actions.access)){
else if(this.p.userPermission(this.permissionList.Chat.access) && this.p.userPermission(this.permissionList.Actions.access)){
this.router.navigate(['/home/chat']);
}
else if(this.permissionService.userPermission(this.permissionList.Actions.access)){
alert('here')
else if(this.p.userPermission(this.permissionList.Actions.access)){
this.router.navigate(['/home/publications']);
}
}