monkey-front-core 0.0.342 → 0.0.344
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.
- package/esm2020/lib/core/services/auth/monkeyecx-auth-guard-role.service.mjs +16 -86
- package/fesm2015/monkey-front-core.mjs +18 -85
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +16 -82
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/services/auth/monkeyecx-auth-guard-role.service.d.ts +7 -0
- package/monkey-front-core-0.0.344.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.342.tgz +0 -0
|
@@ -4112,88 +4112,22 @@ 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
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
constructor(storageService, router) {
|
|
4119
|
-
this.storageService = storageService;
|
|
4120
|
-
this.router = router;
|
|
4121
|
-
this.tokenCredentials = null;
|
|
4122
|
-
// not to do
|
|
4123
|
-
}
|
|
4124
|
-
navigateToErrorPage() {
|
|
4125
|
-
let path = '/app/pages/forbidden';
|
|
4126
|
-
if (companyType) {
|
|
4127
|
-
path = `/app/${companyType}/pages/forbidden`;
|
|
4128
|
-
}
|
|
4129
|
-
this.router?.navigate([path.toLowerCase()]);
|
|
4130
|
-
}
|
|
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 || '';
|
|
4142
|
-
}
|
|
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 {
|
|
4155
|
-
ret = false;
|
|
4156
|
-
if (found > -1) {
|
|
4157
|
-
ret = true;
|
|
4158
|
-
}
|
|
4159
|
-
}
|
|
4160
|
-
if (!roles || roles.length === 0 || this.getRole() === 'PROGRAM_ADMIN') {
|
|
4161
|
-
ret = true;
|
|
4162
|
-
}
|
|
4163
|
-
return ret;
|
|
4164
|
-
}
|
|
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;
|
|
4181
|
-
}
|
|
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;
|
|
4115
|
+
class MonkeyEcxAuthGuardByRole {
|
|
4116
|
+
constructor() {
|
|
4117
|
+
// not to do
|
|
4192
4118
|
}
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4119
|
+
async canActivate() {
|
|
4120
|
+
return false;
|
|
4121
|
+
}
|
|
4122
|
+
}
|
|
4123
|
+
MonkeyEcxAuthGuardByRole.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthGuardByRole, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4124
|
+
MonkeyEcxAuthGuardByRole.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthGuardByRole, providedIn: 'root' });
|
|
4125
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthGuardByRole, decorators: [{
|
|
4126
|
+
type: Injectable,
|
|
4127
|
+
args: [{
|
|
4128
|
+
providedIn: 'root'
|
|
4129
|
+
}]
|
|
4130
|
+
}], ctorParameters: function () { return []; } });
|
|
4197
4131
|
|
|
4198
4132
|
class MonkeyEcxAuthGuard {
|
|
4199
4133
|
constructor(monkeyecxAuthenticationService) {
|
|
@@ -5720,5 +5654,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
5720
5654
|
* Generated bundle index. Do not edit.
|
|
5721
5655
|
*/
|
|
5722
5656
|
|
|
5723
|
-
export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard,
|
|
5657
|
+
export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, 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 };
|
|
5724
5658
|
//# sourceMappingURL=monkey-front-core.mjs.map
|