monkey-front-core 0.0.340 → 0.0.342

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4112,88 +4112,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
4112
4112
  args: [{ providedIn: 'root' }]
4113
4113
  }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }]; } });
4114
4114
 
4115
- const forRoles = (roles, companyType, byExclusion) => {
4116
- class RoleCheck {
4117
- constructor(storageService, router) {
4118
- this.storageService = storageService;
4119
- this.router = router;
4120
- this.tokenCredentials = null;
4121
- // not to do
4122
- }
4123
- navigateToErrorPage() {
4124
- let path = '/app/pages/forbidden';
4125
- if (companyType) {
4126
- path = `/app/${companyType}/pages/forbidden`;
4115
+ let MonkeyEcxAuthGuardByRoleService = class MonkeyEcxAuthGuardByRoleService {
4116
+ static forRoles(roles, companyType, byExclusion) {
4117
+ class RoleCheck {
4118
+ constructor(storageService, router) {
4119
+ this.storageService = storageService;
4120
+ this.router = router;
4121
+ this.tokenCredentials = null;
4122
+ // not to do
4127
4123
  }
4128
- this.router?.navigate([path.toLowerCase()]);
4129
- }
4130
- getRole() {
4131
- const { tokenCredentials } = this;
4132
- if (!tokenCredentials)
4133
- return '';
4134
- if (tokenCredentials?.programAdmin === 'true') {
4135
- return 'PROGRAM_ADMIN';
4124
+ navigateToErrorPage() {
4125
+ let path = '/app/pages/forbidden';
4126
+ if (companyType) {
4127
+ path = `/app/${companyType}/pages/forbidden`;
4128
+ }
4129
+ this.router?.navigate([path.toLowerCase()]);
4136
4130
  }
4137
- if (tokenCredentials?.programAdmin === true) {
4138
- return 'PROGRAM_ADMIN';
4131
+ getRole() {
4132
+ const { tokenCredentials } = this;
4133
+ if (!tokenCredentials)
4134
+ return '';
4135
+ if (tokenCredentials?.programAdmin === 'true') {
4136
+ return 'PROGRAM_ADMIN';
4137
+ }
4138
+ if (tokenCredentials?.programAdmin === true) {
4139
+ return 'PROGRAM_ADMIN';
4140
+ }
4141
+ return tokenCredentials?.role || '';
4139
4142
  }
4140
- return tokenCredentials?.role || '';
4141
- }
4142
- allowedSecurityAccess(roles) {
4143
- if (!roles?.length)
4144
- return true;
4145
- const found = roles?.indexOf(this.getRole());
4146
- let ret = false;
4147
- if (byExclusion) {
4148
- ret = true;
4149
- if (found > -1) {
4143
+ allowedSecurityAccess(roles) {
4144
+ if (!roles?.length)
4145
+ return true;
4146
+ const found = roles?.indexOf(this.getRole());
4147
+ let ret = false;
4148
+ if (byExclusion) {
4149
+ ret = true;
4150
+ if (found > -1) {
4151
+ ret = false;
4152
+ }
4153
+ }
4154
+ else {
4150
4155
  ret = false;
4156
+ if (found > -1) {
4157
+ ret = true;
4158
+ }
4151
4159
  }
4152
- }
4153
- else {
4154
- ret = false;
4155
- if (found > -1) {
4160
+ if (!roles || roles.length === 0 || this.getRole() === 'PROGRAM_ADMIN') {
4156
4161
  ret = true;
4157
4162
  }
4163
+ return ret;
4158
4164
  }
4159
- if (!roles || roles.length === 0 || this.getRole() === 'PROGRAM_ADMIN') {
4160
- ret = true;
4161
- }
4162
- return ret;
4163
- }
4164
- async canActivate() {
4165
- console.log('roles');
4166
- console.log(roles);
4167
- if (!this.tokenCredentials) {
4168
- this.tokenCredentials = await this.storageService.getToken();
4169
- }
4170
- console.log('this.tokenCredentials');
4171
- console.log(this.tokenCredentials);
4172
- console.log('checando');
4173
- if (!this.allowedSecurityAccess(roles)) {
4174
- console.log('checou erro');
4175
- this.navigateToErrorPage();
4176
- return false;
4165
+ async canActivate() {
4166
+ console.log('roles');
4167
+ console.log(roles);
4168
+ if (!this.tokenCredentials) {
4169
+ this.tokenCredentials = await this.storageService.getToken();
4170
+ }
4171
+ console.log('this.tokenCredentials');
4172
+ console.log(this.tokenCredentials);
4173
+ console.log('checando');
4174
+ if (!this.allowedSecurityAccess(roles)) {
4175
+ console.log('checou erro');
4176
+ this.navigateToErrorPage();
4177
+ return false;
4178
+ }
4179
+ console.log('checou ok');
4180
+ return true;
4177
4181
  }
4178
- console.log('checou ok');
4179
- return true;
4180
4182
  }
4183
+ RoleCheck.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoleCheck, deps: [{ token: MonkeyEcxTokenStorageService }, { token: i2$2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4184
+ RoleCheck.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoleCheck, providedIn: 'root' });
4185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoleCheck, decorators: [{
4186
+ type: Injectable,
4187
+ args: [{
4188
+ providedIn: 'root'
4189
+ }]
4190
+ }], ctorParameters: function () { return [{ type: MonkeyEcxTokenStorageService }, { type: i2$2.Router }]; } });
4191
+ return RoleCheck;
4181
4192
  }
4182
- RoleCheck.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoleCheck, deps: [{ token: MonkeyEcxTokenStorageService }, { token: i2$2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4183
- RoleCheck.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoleCheck, providedIn: 'root' });
4184
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoleCheck, decorators: [{
4185
- type: Injectable,
4186
- args: [{
4187
- providedIn: 'root'
4188
- }]
4189
- }], ctorParameters: function () { return [{ type: MonkeyEcxTokenStorageService }, { type: i2$2.Router }]; } });
4190
- return RoleCheck;
4191
- };
4192
-
4193
- var monkeyecxAuthGuardRole_service = /*#__PURE__*/Object.freeze({
4194
- __proto__: null,
4195
- forRoles: forRoles
4196
- });
4193
+ };
4194
+ MonkeyEcxAuthGuardByRoleService = __decorate([
4195
+ Injectable({ providedIn: 'root' })
4196
+ ], MonkeyEcxAuthGuardByRoleService);
4197
4197
 
4198
4198
  class MonkeyEcxAuthGuard {
4199
4199
  constructor(monkeyecxAuthenticationService) {
@@ -5720,5 +5720,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
5720
5720
  * Generated bundle index. Do not edit.
5721
5721
  */
5722
5722
 
5723
- export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, monkeyecxAuthGuardRole_service as MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxCurrencyConfigService, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDisplayInitialsPipe, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureByProgramDirective, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatBeaufityJSONPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPaginationService, MonkeyEcxPipesModule, MonkeyEcxPopoverDirective, MonkeyEcxPopoverOptionsDirective, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModule, OpSearch, POPOVER_OPTIONS, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
5723
+ export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRoleService, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxCurrencyConfigService, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDisplayInitialsPipe, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureByProgramDirective, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatBeaufityJSONPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPaginationService, MonkeyEcxPipesModule, MonkeyEcxPopoverDirective, MonkeyEcxPopoverOptionsDirective, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModule, OpSearch, POPOVER_OPTIONS, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
5724
5724
  //# sourceMappingURL=monkey-front-core.mjs.map