From 3f74dc3fc2d18c9a98a265434ee7291f641d0853 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Thu, 7 Apr 2022 17:51:47 +0100 Subject: [PATCH 01/11] save --- src/app/guards/inactivity.guard.ts | 4 ++-- src/app/pages/chat/chat.page.html | 4 ++-- src/app/pages/inactivity/inactivity.page.ts | 4 ++-- src/app/pages/login/login.page.ts | 2 +- src/app/services/chat/ws-chat-methods.service.ts | 14 +++++++------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/app/guards/inactivity.guard.ts b/src/app/guards/inactivity.guard.ts index f3a06be73..3c4e68c55 100644 --- a/src/app/guards/inactivity.guard.ts +++ b/src/app/guards/inactivity.guard.ts @@ -26,7 +26,7 @@ export class InactivityGuard implements CanActivate { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ this.router.navigate(['/home/events']); } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ @@ -59,7 +59,7 @@ export class InactivityGuard implements CanActivate { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ this.router.navigate(['/home/events']); } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 699ed9fa2..9e6a51349 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -111,7 +111,7 @@ - +
@@ -150,7 +150,7 @@
- +
diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index 9d3c2387d..f53df3185 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -207,7 +207,7 @@ export class InactivityPage implements OnInit { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ this.router.navigate(['/home/events'], {replaceUrl: true}); } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ @@ -230,7 +230,7 @@ export class InactivityPage implements OnInit { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ this.router.navigate(['/home/events']); } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 655e60d2b..308d8543e 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -165,7 +165,7 @@ export class LoginPage implements OnInit { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ this.router.navigate(['/home/events']); } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index 8780bb626..6d8ae3d30 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -33,7 +33,7 @@ export class WsChatMethodsService { _dm: RoomService[] = [] _group: RoomService[] = [] - loadingWholeList = false + loadingWholeList = false; dmCount = 0; groupCount = 0; @@ -121,7 +121,7 @@ export class WsChatMethodsService { this._dm = [] this._group = [] - this.loadingWholeList = false + this.loadingWholeList = false; this.dmCount = 0; this.groupCount = 0; @@ -177,13 +177,13 @@ export class WsChatMethodsService { const roomId = this.getRoomId(roomData); if(roomData.t == 'd') { - + const res = await this.chatService.getMembers(roomId).toPromise(); - + const members = res['members']; const users = members.filter(data => data.username != this.loggedUser.me.username); rooms.result.update[index]['members'] = users - + await this.prepareRoom(roomData); } else { if (roomData.t === 'p') { @@ -209,7 +209,7 @@ export class WsChatMethodsService { console.log('save rooms', rooms) await this.storage.set('Rooms', rooms); - + setTimeout(()=>{ this.sortRoomList() }, 1000) @@ -218,7 +218,7 @@ export class WsChatMethodsService { setTimeout(()=>{ this.sortRoomList() }, 10000) - + this.loadingWholeList = false } From b7851e9544289cdd85fd712c88b925a573fc1ee4 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 8 Apr 2022 10:57:38 +0100 Subject: [PATCH 02/11] add validation to routes when user has no calendar --- src/app/guards/inactivity.guard.ts | 24 +++++++++++++++++---- src/app/pages/inactivity/inactivity.page.ts | 18 ++++++++++++++-- src/app/pages/login/login.page.ts | 9 +++++++- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/app/guards/inactivity.guard.ts b/src/app/guards/inactivity.guard.ts index 3c4e68c55..bfd436d18 100644 --- a/src/app/guards/inactivity.guard.ts +++ b/src/app/guards/inactivity.guard.ts @@ -24,14 +24,22 @@ export class InactivityGuard implements CanActivate { if (this.platform.is('desktop') || this.platform.is('mobileweb')) { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events']); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } + //If user has access permission to both Chat and Action, goes to Chat by default. else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ this.router.navigate(['/home/publications']); - } else { + } + else { this.alertController.create({ cssClass: 'my-custom-class', @@ -57,14 +65,22 @@ export class InactivityGuard implements CanActivate { else { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events']); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } + //If user has access permission to both Chat and Action, goes to Chat by default. else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ this.router.navigate(['/home/publications']); - } else { + } + else { this.alertController.create({ cssClass: 'my-custom-class', header: 'Utilizador sem acesso a aplicação', diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index f53df3185..a6d0d98ef 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -205,8 +205,15 @@ export class InactivityPage implements OnInit { setTimeout(()=>{ if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events'], {replaceUrl: true}); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } + //If user has access permission to both Chat and Action, goes to Chat by default. else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } @@ -228,8 +235,15 @@ export class InactivityPage implements OnInit { SessionStore.setPin(code); if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events']); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } + //If user has access permission to both Chat and Action, goes to Chat by default. else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 308d8543e..751c3cb26 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -163,8 +163,15 @@ export class LoginPage implements OnInit { this.router.navigate([pathName]); } else { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events']); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } + //If user has access permission to both Chat and Action, goes to Chat by default. else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } From 773761a2200469677f5c15e8d9d2335a41058b9f Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 8 Apr 2022 11:18:54 +0100 Subject: [PATCH 03/11] save --- src/app/home/home.page.html | 2 +- src/app/shared/header/header.page.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index 6a1a14f6e..7bb431e4b 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -1,6 +1,6 @@ - + diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index 093146e7d..94a3add96 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -64,7 +64,7 @@
-
+
From 1a7175fc51b2ce2ae952bee363a4e2062d1614ef Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 8 Apr 2022 11:49:04 +0100 Subject: [PATCH 04/11] hide diplomas por validar when user as not permisssion --- .../diplomas/diplomas.page.html | 22 +++++++++---------- .../diplomas/diplomas.page.html | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html index 2fb25a676..39f4f7fd9 100644 --- a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html +++ b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html @@ -15,7 +15,7 @@
- + Por validar ... @@ -30,14 +30,14 @@ - +
-
+
- - +
-
-
Lista vazia
- + diff --git a/src/app/shared/gabinete-digital/diplomas/diplomas.page.html b/src/app/shared/gabinete-digital/diplomas/diplomas.page.html index 7b85534a7..c9702e023 100644 --- a/src/app/shared/gabinete-digital/diplomas/diplomas.page.html +++ b/src/app/shared/gabinete-digital/diplomas/diplomas.page.html @@ -10,7 +10,7 @@
- + Diplomas por validar @@ -23,7 +23,7 @@
-
+
Date: Fri, 8 Apr 2022 12:31:23 +0100 Subject: [PATCH 05/11] fix: change menu postion based on platform --- src/app/home/home.page.html | 5 +++++ src/app/home/home.page.scss | 10 +++++----- src/app/home/home.page.ts | 4 ++-- src/app/shared/header/header.page.html | 3 ++- src/app/shared/header/header.page.scss | 22 ++++++++++++++-------- src/app/shared/header/header.page.ts | 2 +- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index 7bb431e4b..75227f2c7 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -1,5 +1,7 @@ +
+ @@ -39,5 +41,8 @@ + +
+ diff --git a/src/app/home/home.page.scss b/src/app/home/home.page.scss index 2126a0282..a000a1538 100644 --- a/src/app/home/home.page.scss +++ b/src/app/home/home.page.scss @@ -40,12 +40,12 @@ ion-badge {/* */ } -@media only screen and (min-width: 1366px) { +// @media only screen and (min-width: 1366px) { - ion-tabs.tab .bottoms{ - display: none; - } -} +// ion-tabs.tab .bottoms{ +// display: none; +// } +// } ion-tab-button.active{ diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index cdf65323c..c1d02bdab 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -87,13 +87,13 @@ export class HomePage implements OnInit { public user: UserSession; permissionList = new PermissionList(); loggeduser: LoginUserRespose; - + constructor( private router: Router, public modalCtrl: AlertController, private notificationsService: NotificationsService, - private platform: Platform, + public platform: Platform, private activeroute: ActivatedRoute, /* private webnotification: WebNotificationsService, */ public p: PermissionService, diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index 94a3add96..e27af24a8 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -47,7 +47,7 @@
-
+
+
diff --git a/src/app/shared/header/header.page.scss b/src/app/shared/header/header.page.scss index 3265696a1..fe999aaa4 100644 --- a/src/app/shared/header/header.page.scss +++ b/src/app/shared/header/header.page.scss @@ -121,16 +121,22 @@ display: none; } -@media only screen and (min-width: 1366px) { +// @media only screen and (min-width: 1366px) { - .mobile{ - display: none !important; - } - .desktop{ - display: block; - } +// .mobile{ +// display: none !important; +// } +// .desktop{ +// display: block; +// } -} +// } +.mobile{ + display: none !important; + } + .desktop{ + display: block; + } .tab{ height: 65px; diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index b91aa2d7a..e61de5c6c 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -39,7 +39,7 @@ export class HeaderPage implements OnInit { private modalController: ModalController, private animationController: AnimationController, private storageservice: StorageService, - private platform: Platform, + public platform: Platform, //private notificationsService: NotificationsService, private eventrigger: EventTrigger, public ThemeService: ThemeService, From 7c5c4acf0e6643bfc33555fa45f50d32b564db29 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 8 Apr 2022 13:52:00 +0100 Subject: [PATCH 06/11] improve --- src/app/guards/auth.guard.ts | 28 ++++++++++++- src/app/guards/inactivity.guard.ts | 2 +- src/app/guards/login.guard.ts | 7 +++- src/app/home/home.page.ts | 3 +- src/app/services/route.service.ts | 9 +++++ .../worker/document-counter.service.spec.ts | 16 -------- .../worker/document-counter.service.ts | 39 ------------------- 7 files changed, 43 insertions(+), 61 deletions(-) delete mode 100644 src/app/services/worker/document-counter.service.spec.ts delete mode 100644 src/app/services/worker/document-counter.service.ts diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index f8c5cbbda..688f6d22c 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -5,7 +5,7 @@ import { AuthService } from '../services/auth.service'; import { PermissionService } from '../services/permission.service'; import { LocalstoreService } from '../store/localstore.service'; import { SessionStore } from '../store/session.service'; - +import { RouteService } from 'src/app/services/route.service' @Injectable({ providedIn: 'root' }) @@ -15,6 +15,7 @@ export class AuthGuard implements CanActivate { private localstoreService: LocalstoreService, private authService: AuthService, public p: PermissionService, + private RouteService: RouteService ){} canActivate( @@ -35,7 +36,30 @@ export class AuthGuard implements CanActivate { this.authService.loginChat(); } - return true; + const pathname = window.location.pathname + + if(this.p.userPermission(this.p.permissionList.Agenda.access) && pathname.startsWith('/home/agenda')) { + return true; + } else if (this.p.userPermission(this.p.permissionList.Gabinete.access) && pathname.startsWith('/home/gabinete-digital')) { + return true; + } + else if(this.p.userPermission(this.p.permissionList.Chat.access) && pathname.startsWith('/home/chat')) { + return true; + } else if(this.p.userPermission(this.p.permissionList.Actions.access) && pathname.startsWith('/home/publications')) { + return true; + } else if ((this.p.userPermission([this.p.permissionList.Agenda.access]) || this.p.userPermission([this.p.permissionList.Gabinete.access])) && pathname.startsWith('/home/events')) { + + } else if (pathname == '/') { + return true + } + else if (this.RouteService.history.length >= 1) { + const pathName = this.RouteService.getLastRouteA() + this.router.navigate([pathName]); + } else { + this.router.navigate(['/']); + } + + return false; } } diff --git a/src/app/guards/inactivity.guard.ts b/src/app/guards/inactivity.guard.ts index f3a06be73..e4cd3f7a8 100644 --- a/src/app/guards/inactivity.guard.ts +++ b/src/app/guards/inactivity.guard.ts @@ -29,7 +29,7 @@ export class InactivityGuard implements CanActivate { else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ this.router.navigate(['/home/chat']); } - else if(this.p.userPermission(this.p.permissionList.Actions.access)){ + else if(this.p.userPermission(this.p.permissionList.Actions.access)) { this.router.navigate(['/home/publications']); } else { diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts index 8b7a734d3..d086c6180 100644 --- a/src/app/guards/login.guard.ts +++ b/src/app/guards/login.guard.ts @@ -3,12 +3,16 @@ import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Rout import { Observable } from 'rxjs'; import { SessionStore } from '../store/session.service'; import { Platform } from '@ionic/angular'; +import { RouteService } from 'src/app/services/route.service' @Injectable({ providedIn: 'root' }) export class LoginGuard implements CanActivate { - constructor( private router:Router, private platform: Platform,) { + constructor( + private router:Router, + private platform: Platform, + private RouteService: RouteService ) { } canActivate( @@ -27,6 +31,7 @@ export class LoginGuard implements CanActivate { } else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' && !this.platform.is('desktop') && !this.platform.is('mobileweb')) { this.router.navigate(['/inactivity']); return false + } else { return true } diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 04b9a5291..668efb97f 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -15,7 +15,6 @@ import { SessionStore } from '../store/session.service'; import { StorageService } from '../services/storage.service'; import { File } from '@ionic-native/file/ngx'; /* import { WebNotificationPopupService } from '../services/notification/web-notification-popup.service'; */ -import { DocumentCounterService } from '../services/worker/document-counter.service'; import { PermissionService } from '../services/permission.service'; import { BackgroundService } from 'src/app/services/background.service'; import { OfflineManagerService } from 'src/app/services/offline-manager.service'; @@ -33,6 +32,7 @@ import { NativeNotificationService } from 'src/app/services/native-notification. import { UserSession } from '../models/user.model'; import { PermissionList } from '../models/permission/permissionList'; + @Component({ selector: 'app-home', templateUrl: './home.page.html', @@ -92,7 +92,6 @@ export class HomePage implements OnInit { private activeroute: ActivatedRoute, /* private webnotification: WebNotificationsService, */ public p: PermissionService, - public documentCounterService: DocumentCounterService, private despachoRule: DespachoService, private inativityService: InativityService, private storageService: StorageService, diff --git a/src/app/services/route.service.ts b/src/app/services/route.service.ts index 2f0c59440..ac5b250b4 100644 --- a/src/app/services/route.service.ts +++ b/src/app/services/route.service.ts @@ -88,4 +88,13 @@ export class RouteService { } + + getLastRoute() { + return this.history[this.history.length - 1] + } + + getLastRouteA() { + return this.history[this.history.length - 2] + } + } diff --git a/src/app/services/worker/document-counter.service.spec.ts b/src/app/services/worker/document-counter.service.spec.ts deleted file mode 100644 index bc3c0f89e..000000000 --- a/src/app/services/worker/document-counter.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { DocumentCounterService } from './document-counter.service'; - -describe('DocumentCounterService', () => { - let service: DocumentCounterService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(DocumentCounterService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/services/worker/document-counter.service.ts b/src/app/services/worker/document-counter.service.ts deleted file mode 100644 index eafc6e6db..000000000 --- a/src/app/services/worker/document-counter.service.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Injectable } from '@angular/core'; -import { DespachoStore } from 'src/app/store/despacho-store.service'; -import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service'; -import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service'; -import { PendentesStore } from 'src/app/store/pendestes-store.service'; -import { PedidosStore } from 'src/app/store/pedidos-store.service'; -import { DespachosprStore } from 'src/app/store/despachospr-store.service'; -import { DeplomasStore } from 'src/app/store/deplomas.service'; - - -@Injectable({ - providedIn: 'root' -}) -export class DocumentCounterService { - - expedienteGbStore = ExpedienteGdStore; - pendentesStore = PendentesStore; - despachoStore = DespachoStore; - eventoAprovacaoStore = EventoAprovacaoStore; - pedidosStore = PedidosStore; - // expedientePrStore = ExpedienteprStore; - despachoPrStore = DespachosprStore; - deplomasStore = DeplomasStore - - constructor() { } - - // falta a contagem dos deplomas - get mdTotalDocument(): number { - return this.despachoStore.count + /** this.expedientePrStore.count + */ this.pedidosStore.countdeferimento - + this.pedidosStore.countparecer + this.expedienteGbStore.count + this.despachoPrStore.count + this.pendentesStore.count - + this.eventoAprovacaoStore.count + this.deplomasStore.diplomasListCount + this.deplomasStore.countDiplomasAssinadoListCount + this.deplomasStore.deplomasReviewCount - } - - get prTotalDocument(): number { - return this.despachoStore.count + /** this.expedientePrStore.count + */ this.pedidosStore.countdeferimento - + this.pedidosStore.countparecer + this.expedienteGbStore.count + this.despachoPrStore.count + this.pendentesStore.count - + this.eventoAprovacaoStore.count + this.deplomasStore.diplomasListCount + this.deplomasStore.countDiplomasAssinadoListCount + this.deplomasStore.deplomasReviewCount - } -} From 450b5b68456127fd6a9131ea21cfe834c7b7b20f Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 8 Apr 2022 14:23:04 +0100 Subject: [PATCH 07/11] route permission --- src/app/guards/auth.guard.ts | 58 +++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index 688f6d22c..27f9e29b3 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -32,34 +32,58 @@ export class AuthGuard implements CanActivate { this.router.navigate(['/']); return false } else { - if(this.p.userPermission(this.p.permissionList.Chat.access) == true){ + if(this.p.userPermission(this.p.permissionList.Chat.access) == true) { this.authService.loginChat(); } const pathname = window.location.pathname - if(this.p.userPermission(this.p.permissionList.Agenda.access) && pathname.startsWith('/home/agenda')) { - return true; - } else if (this.p.userPermission(this.p.permissionList.Gabinete.access) && pathname.startsWith('/home/gabinete-digital')) { - return true; - } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && pathname.startsWith('/home/chat')) { - return true; - } else if(this.p.userPermission(this.p.permissionList.Actions.access) && pathname.startsWith('/home/publications')) { - return true; - } else if ((this.p.userPermission([this.p.permissionList.Agenda.access]) || this.p.userPermission([this.p.permissionList.Gabinete.access])) && pathname.startsWith('/home/events')) { + if(this.p.userPermission(pathname.startsWith('/home/agenda'))) { + if(this.p.permissionList.Agenda.access) { + return true; + } else { + this.router.navigate(['/login']); + return false; + } + + } else if ( pathname.startsWith('/home/gabinete-digital')) { + + if(this.p.userPermission(this.p.permissionList.Gabinete.access)) { + return true; + } else { + this.router.navigate(['/login']); + return false; + } + } + else if(pathname.startsWith('/home/chat')) { + if(this.p.userPermission(this.p.permissionList.Gabinete.access)) { + return true; + } else { + this.router.navigate(['/login']); + return false; + } + } else if(pathname.startsWith('/home/publications')) { + if(this.p.userPermission(this.p.permissionList.Actions.access)) { + return true + } else { + this.router.navigate(['/login']); + return false + } + } else if (pathname.startsWith('/home/events')) { + if((this.p.userPermission([this.p.permissionList.Agenda.access]) || this.p.userPermission([this.p.permissionList.Gabinete.access]))) { + return true + } else { + this.router.navigate(['/login']); + return false + } } else if (pathname == '/') { return true - } - else if (this.RouteService.history.length >= 1) { - const pathName = this.RouteService.getLastRouteA() - this.router.navigate([pathName]); } else { - this.router.navigate(['/']); + this.router.navigate(['/login']); + return false } - return false; } } From c209680add2b810304ed2bfe308b618feaf7b9e0 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 8 Apr 2022 14:49:10 +0100 Subject: [PATCH 08/11] fix access to chat and agenda (user has no own calendar) --- src/app/guards/auth.guard.ts | 6 +++--- src/app/home/home.page.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index 27f9e29b3..e63c51d61 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -46,7 +46,7 @@ export class AuthGuard implements CanActivate { this.router.navigate(['/login']); return false; } - + } else if ( pathname.startsWith('/home/gabinete-digital')) { if(this.p.userPermission(this.p.permissionList.Gabinete.access)) { @@ -57,7 +57,7 @@ export class AuthGuard implements CanActivate { } } else if(pathname.startsWith('/home/chat')) { - if(this.p.userPermission(this.p.permissionList.Gabinete.access)) { + if(this.p.userPermission(this.p.permissionList.Chat.access)) { return true; } else { this.router.navigate(['/login']); @@ -71,7 +71,7 @@ export class AuthGuard implements CanActivate { return false } } else if (pathname.startsWith('/home/events')) { - if((this.p.userPermission([this.p.permissionList.Agenda.access]) || this.p.userPermission([this.p.permissionList.Gabinete.access]))) { + if((SessionStore.user.OwnerCalendars.length != 0 || this.p.userPermission([this.p.permissionList.Gabinete.access]))) { return true } else { this.router.navigate(['/login']); diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index 75227f2c7..d6c13e52a 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -1,6 +1,6 @@ -
+
From 02fb2c572d6ea8cbf9662f640fd6dc5e3cb36448 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 8 Apr 2022 14:50:02 +0100 Subject: [PATCH 09/11] fix --- src/app/guards/auth.guard.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index 27f9e29b3..603848abc 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -57,7 +57,7 @@ export class AuthGuard implements CanActivate { } } else if(pathname.startsWith('/home/chat')) { - if(this.p.userPermission(this.p.permissionList.Gabinete.access)) { + if(this.p.userPermission(this.p.permissionList.Actions.access)) { return true; } else { this.router.navigate(['/login']); @@ -71,7 +71,7 @@ export class AuthGuard implements CanActivate { return false } } else if (pathname.startsWith('/home/events')) { - if((this.p.userPermission([this.p.permissionList.Agenda.access]) || this.p.userPermission([this.p.permissionList.Gabinete.access]))) { + if((this.p.userPermission(SessionStore.user.OwnerCalendars.length >= 1 || this.p.userPermission([this.p.permissionList.Gabinete.access]))) { return true } else { this.router.navigate(['/login']); From c5656fd82f33b69c160431e9163d26c06fb554ef Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 8 Apr 2022 15:49:35 +0100 Subject: [PATCH 10/11] take out Evandre changes --- src/app/home/home.page.html | 2 -- src/app/home/home.page.scss | 10 +++++----- .../chat/group-messages/group-messages.page.ts | 1 - src/app/shared/header/header.page.html | 2 +- src/app/shared/header/header.page.scss | 17 +++++++++-------- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index d6c13e52a..098f0498c 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -1,6 +1,5 @@ -
@@ -42,7 +41,6 @@ -
diff --git a/src/app/home/home.page.scss b/src/app/home/home.page.scss index a000a1538..a9aadc14c 100644 --- a/src/app/home/home.page.scss +++ b/src/app/home/home.page.scss @@ -40,12 +40,12 @@ ion-badge {/* */ } -// @media only screen and (min-width: 1366px) { + @media only screen and (min-width: 1366px) { -// ion-tabs.tab .bottoms{ -// display: none; -// } -// } + ion-tabs.tab .bottoms{ + display: none; + } + } ion-tab-button.active{ diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index b17cbd288..c2588adb2 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -650,7 +650,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { temporaryData: formData, attachments: [{ "title": capturedImageTitle, - //"image_url": capturedImage, // rocketchat "text": "description", "title_link_download": false, }] diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index e27af24a8..0839556f0 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -47,7 +47,7 @@
-
+