mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
fix to accept login of user that does not have access to Chat
This commit is contained in:
@@ -8,6 +8,7 @@ import { AlertController } from '@ionic/angular';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-inactivity',
|
||||
@@ -31,6 +32,7 @@ export class InactivityPage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
public alertController: AlertController,
|
||||
public ThemeService: ThemeService,
|
||||
public p: PermissionService,
|
||||
) {}
|
||||
|
||||
loop = false
|
||||
@@ -115,10 +117,15 @@ export class InactivityPage implements OnInit {
|
||||
|
||||
if (attempt) {
|
||||
|
||||
|
||||
// if current attemp is equal to the current user
|
||||
if (attempt.UserId == SessionStore.user.UserId) {
|
||||
await this.authService.SetSession(attempt, this.userattempt);
|
||||
this.authService.loginChat();
|
||||
|
||||
if(this.p.userPermission(this.p.permissionList.Chat.access)){
|
||||
this.authService.loginChat();
|
||||
}
|
||||
|
||||
this.getToken();
|
||||
SessionStore.setInativity(true)
|
||||
|
||||
|
||||
@@ -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']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user