Files
doneit-web/.angular/cache/14.2.12/babel-webpack/0c4a29e3f0c98a89029816a723e8a25b.json
T
Eudes Inácio 53b71ea16f its working
2023-06-30 09:54:21 +01:00

1 line
14 KiB
JSON

{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { __decorate } from \"tslib\";\nimport { Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { SessionStore } from '../store/session.service';\nimport { AlertController, Platform } from '@ionic/angular';\nimport { PermissionService } from '../services/permission.service';\nimport { FirstEnterService } from '../services/first-enter.service';\nlet InactivityGuard = class InactivityGuard {\n constructor(router, platform, p, alertController, FirstEnterService) {\n this.router = router;\n this.platform = platform;\n this.p = p;\n this.alertController = alertController;\n this.FirstEnterService = FirstEnterService;\n }\n canActivate(route, state) {\n // console.log('hire inactinity!', state.url)\n if (this.platform.is('desktop') || this.platform.is('mobileweb')) {\n if (this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)) {\n //When user has got access to Agenda but does not have their own calendar, goes to Agenda\n if (this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0) {\n this.router.navigate(['/home/agenda']);\n } else {\n this.router.navigate(['/home/events']);\n }\n } else if (this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) {\n this.router.navigate(['/home/chat']);\n } else if (this.p.userPermission(this.p.permissionList.Actions.access)) {\n this.router.navigate(['/home/publications']);\n } else {\n this.alertController.create({\n cssClass: 'my-custom-class',\n header: 'Utilizador sem acesso a aplicação',\n buttons: [{\n text: 'Ok',\n handler: () => {}\n }]\n }).then( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (alertPopup) {\n yield alertPopup.present();\n });\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n return false;\n } else if (SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin) {\n // set pin\n return true;\n } else if (SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin') {\n // inactivity login\n return true;\n } else if (!SessionStore.user.Inactivity && this.platform.is('mobile')) {\n // try to login\n return true;\n } else if (SessionStore.user.LoginPreference != 'Pin' && SessionStore.hasPin) {\n // no right to be in this page\n this.router.navigateByUrl('/', {\n replaceUrl: true\n });\n return false;\n } //Mobile or Tablet without session\n else {\n if (SessionStore?.user?.Inactivity) {\n if (this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)) {\n //When user has got access to Agenda but does not have their own calendar, goes to Agenda\n if (this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0) {\n this.router.navigate(['/home/agenda']);\n } else {\n this.router.navigate(['/home/events']);\n }\n } else if (this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) {\n this.router.navigate(['/home/chat']);\n } else if (this.p.userPermission(this.p.permissionList.Actions.access)) {\n this.router.navigate(['/home/publications']);\n } else {\n this.alertController.create({\n cssClass: 'my-custom-class',\n header: 'Utilizador sem acesso a aplicação',\n buttons: [{\n text: 'Ok',\n handler: () => {}\n }]\n }).then( /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator(function* (alertPopup) {\n yield alertPopup.present();\n });\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n }());\n }\n return false;\n }\n }\n }\n};\nInactivityGuard.ctorParameters = () => [{\n type: Router\n}, {\n type: Platform\n}, {\n type: PermissionService\n}, {\n type: AlertController\n}, {\n type: FirstEnterService\n}];\nInactivityGuard = __decorate([Injectable({\n providedIn: 'root'\n})], InactivityGuard);\nexport { InactivityGuard };","map":{"version":3,"mappings":";;AAAA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAA8CC,MAAM,QAAsC,iBAAiB;AAE3G,SAASC,YAAY,QAAQ,0BAA0B;AAC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C,oBAAoB,CAAC,CAAC;SAC7C,MAAM;UACL,IAAI,CAACb,eAAe,CAACgB,MAAM,CAAC;YAC1BC,QAAQ,EAAE,iBAAiB;YAC3BC,MAAM,EAAE,mCAAmC;YAC3CC,OAAO,EAAE,CAAC;cACRC,IAAI,EAAE,IAAI;cACVC,OAAO,EAAEA,MAAK,CAEd;aACD;WACF,CAAC,CAACC,IAAI;YAAA,8BAAE,WAAOC,UAAU,EAAG;cAC3B,MAAMA,UAAU,CAACC,OAAO,EAAE;YAC5B,CAAC;YAAA;cAAA;YAAA;UAAA,IAAC;;QAGJ,OAAO,KAAK;;;EAMpB;;;;;;;;;;;;;AAvGW7B,eAAe,eAH3BP,UAAU,CAAC;EACV2C,UAAU,EAAE;CACb,CAAC,GACWpC,eAAe;SAAfA,eAAe","names":["Injectable","Router","SessionStore","AlertController","Platform","PermissionService","FirstEnterService","InactivityGuard","constructor","router","platform","p","alertController","canActivate","route","state","is","userPermission","permissionList","Agenda","access","Gabinete","user","OwnerCalendars","length","navigate","Chat","Actions","create","cssClass","header","buttons","text","handler","then","alertPopup","present","exist","Inactivity","hasPin","LoginPreference","navigateByUrl","replaceUrl","providedIn"],"sourceRoot":"","sources":["C:\\Users\\eudes.inacio\\GabineteDigital\\gabinete-digital-fo\\src\\app\\guards\\inactivity.guard.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';\r\nimport { Observable } from 'rxjs';\r\nimport { SessionStore } from '../store/session.service';\r\nimport { AlertController, Platform } from '@ionic/angular';\r\nimport { PermissionService } from '../services/permission.service';\r\nimport { FirstEnterService } from '../services/first-enter.service';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class InactivityGuard implements CanActivate {\r\n\r\n constructor(\r\n private router:Router,\r\n private platform: Platform,\r\n public p: PermissionService,\r\n private alertController: AlertController,\r\n private FirstEnterService: FirstEnterService\r\n ) {}\r\n\r\n canActivate(\r\n route: ActivatedRouteSnapshot,\r\n state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {\r\n\r\n // console.log('hire inactinity!', state.url)\r\n\r\n if ( (this.platform.is('desktop') || this.platform.is('mobileweb')) ) {\r\n \r\n if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)) {\r\n //When user has got access to Agenda but does not have their own calendar, goes to Agenda\r\n if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){\r\n this.router.navigate(['/home/agenda']);\r\n }\r\n else{\r\n this.router.navigate(['/home/events']);\r\n }\r\n }\r\n else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){\r\n this.router.navigate(['/home/chat']);\r\n }\r\n else if(this.p.userPermission(this.p.permissionList.Actions.access)) {\r\n this.router.navigate(['/home/publications']);\r\n } else {\r\n\r\n this.alertController.create({\r\n cssClass: 'my-custom-class',\r\n header: 'Utilizador sem acesso a aplicação',\r\n buttons: [{\r\n text: 'Ok',\r\n handler: () => {\r\n\r\n }\r\n }]\r\n }).then( async (alertPopup) => {\r\n await alertPopup.present();\r\n })\r\n\r\n }\r\n\r\n return false\r\n } else if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin ) {\r\n // set pin\r\n return true\r\n } else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin') {\r\n // inactivity login\r\n return true\r\n } else if (!SessionStore.user.Inactivity && this.platform.is('mobile')) {\r\n // try to login\r\n return true\r\n } else if (SessionStore.user.LoginPreference != 'Pin' && SessionStore.hasPin) {\r\n // no right to be in this page\r\n\r\n this.router.navigateByUrl('/', { replaceUrl: true });\r\n return false\r\n }//Mobile or Tablet without session\r\n else {\r\n\r\n if((SessionStore?.user?.Inactivity)) {\r\n if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){\r\n //When user has got access to Agenda but does not have their own calendar, goes to Agenda\r\n if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0) {\r\n this.router.navigate(['/home/agenda']);\r\n }\r\n else{\r\n this.router.navigate(['/home/events']);\r\n }\r\n }\r\n else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){\r\n this.router.navigate(['/home/chat']);\r\n }\r\n else if(this.p.userPermission(this.p.permissionList.Actions.access)){\r\n this.router.navigate(['/home/publications']);\r\n } else {\r\n this.alertController.create({\r\n cssClass: 'my-custom-class',\r\n header: 'Utilizador sem acesso a aplicação',\r\n buttons: [{\r\n text: 'Ok',\r\n handler: () => {\r\n \r\n }\r\n }]\r\n }).then( async (alertPopup)=>{\r\n await alertPopup.present();\r\n })\r\n }\r\n \r\n return false\r\n }\r\n\r\n\r\n }\r\n\r\n }\r\n\r\n}\r\n"]},"metadata":{},"sourceType":"module"}