@cccteam/ccc-lib 0.0.14 → 0.0.15
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/eslint.config.js +32 -0
- package/ng-package.json +11 -0
- package/package.json +4 -61
- package/src/auth-authentication-guard/authentication.guard.ts +40 -0
- package/src/auth-authentication-guard/index.ts +1 -0
- package/src/auth-authentication-guard/ng-package.json +6 -0
- package/src/auth-authorization-guard/authorization.guard.ts +17 -0
- package/src/auth-authorization-guard/index.ts +1 -0
- package/src/auth-authorization-guard/ng-package.json +6 -0
- package/src/auth-forms/ccc-field/ccc-field.component.html +1 -0
- package/src/auth-forms/ccc-field/ccc-field.component.scss +0 -0
- package/src/auth-forms/ccc-field/ccc-field.component.spec.ts +22 -0
- package/src/auth-forms/ccc-field/ccc-field.component.ts +74 -0
- package/src/auth-forms/form-helpers.ts +39 -0
- package/src/auth-forms/index.ts +3 -0
- package/src/auth-forms/ng-package.json +6 -0
- package/src/auth-has-permission/has-permission.directive.ts +34 -0
- package/src/auth-has-permission/index.ts +1 -0
- package/src/auth-has-permission/ng-package.json +6 -0
- package/src/auth-service/auth.service.ts +92 -0
- package/src/auth-service/index.ts +1 -0
- package/src/auth-service/ng-package.json +6 -0
- package/src/ccc-camel-case-to-title/camel-case-to-title.pipe.ts +23 -0
- package/src/ccc-camel-case-to-title/index.ts +1 -0
- package/src/ccc-camel-case-to-title/ng-package.json +6 -0
- package/src/ccc-grid/ccc-grid.component.ts +155 -0
- package/src/ccc-grid/index.ts +3 -0
- package/src/ccc-grid/ng-package.json +6 -0
- package/src/ccc-grid/table-button/table-button.component.html +16 -0
- package/src/ccc-grid/table-button/table-button.component.scss +5 -0
- package/src/ccc-grid/table-button/table-button.component.spec.ts +22 -0
- package/src/ccc-grid/table-button/table-button.component.ts +49 -0
- package/src/ccc-resource/can-deactivate.guard.ts +41 -0
- package/src/ccc-resource/compound-resource/compound-resource.component.html +57 -0
- package/src/ccc-resource/compound-resource/compound-resource.component.scss +86 -0
- package/src/ccc-resource/compound-resource/compound-resource.component.spec.ts +22 -0
- package/src/ccc-resource/compound-resource/compound-resource.component.ts +158 -0
- package/src/ccc-resource/concat-fns.ts +162 -0
- package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.html +12 -0
- package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.scss +0 -0
- package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.spec.ts +23 -0
- package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.ts +17 -0
- package/src/ccc-resource/form-state.service.ts +24 -0
- package/src/ccc-resource/format-fns.ts +49 -0
- package/src/ccc-resource/gui-constants.ts +88 -0
- package/src/ccc-resource/index.ts +23 -0
- package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.html +8 -0
- package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.scss +0 -0
- package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.spec.ts +22 -0
- package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.ts +12 -0
- package/src/ccc-resource/ng-package.json +6 -0
- package/src/ccc-resource/operation-types.ts +19 -0
- package/src/ccc-resource/padding-element/padding-element.component.html +1 -0
- package/src/ccc-resource/padding-element/padding-element.component.scss +3 -0
- package/src/ccc-resource/padding-element/padding-element.component.spec.ts +22 -0
- package/src/ccc-resource/padding-element/padding-element.component.ts +20 -0
- package/src/ccc-resource/resource-array-view/resource-array-view.component.html +81 -0
- package/src/ccc-resource/resource-array-view/resource-array-view.component.scss +21 -0
- package/src/ccc-resource/resource-array-view/resource-array-view.component.spec.ts +22 -0
- package/src/ccc-resource/resource-array-view/resource-array-view.component.ts +143 -0
- package/src/ccc-resource/resource-base/resource-base.component.spec.ts +22 -0
- package/src/ccc-resource/resource-base/resource-base.component.ts +11 -0
- package/src/ccc-resource/resource-cache.service.ts +232 -0
- package/src/ccc-resource/resource-create/resource-create.component.html +31 -0
- package/src/ccc-resource/resource-create/resource-create.component.scss +130 -0
- package/src/ccc-resource/resource-create/resource-create.component.spec.ts +22 -0
- package/src/ccc-resource/resource-create/resource-create.component.ts +303 -0
- package/src/ccc-resource/resource-field/base-field.directive.ts +102 -0
- package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.html +16 -0
- package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.scss +0 -0
- package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.ts +15 -0
- package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.html +13 -0
- package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.scss +0 -0
- package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.spec.ts +23 -0
- package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.ts +50 -0
- package/src/ccc-resource/resource-field/fields/date-field/date-field.component.html +22 -0
- package/src/ccc-resource/resource-field/fields/date-field/date-field.component.scss +0 -0
- package/src/ccc-resource/resource-field/fields/date-field/date-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/date-field/date-field.component.ts +14 -0
- package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.html +71 -0
- package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.scss +9 -0
- package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.ts +207 -0
- package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.html +38 -0
- package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.scss +3 -0
- package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.ts +87 -0
- package/src/ccc-resource/resource-field/fields/number-field/number-field.component.html +23 -0
- package/src/ccc-resource/resource-field/fields/number-field/number-field.component.scss +6 -0
- package/src/ccc-resource/resource-field/fields/number-field/number-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/number-field/number-field.component.ts +14 -0
- package/src/ccc-resource/resource-field/fields/text-field/text-field.component.html +29 -0
- package/src/ccc-resource/resource-field/fields/text-field/text-field.component.scss +6 -0
- package/src/ccc-resource/resource-field/fields/text-field/text-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/text-field/text-field.component.ts +23 -0
- package/src/ccc-resource/resource-field/resource-field.component.html +112 -0
- package/src/ccc-resource/resource-field/resource-field.component.scss +7 -0
- package/src/ccc-resource/resource-field/resource-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/resource-field.component.ts +214 -0
- package/src/ccc-resource/resource-layout/resource-layout.component.html +73 -0
- package/src/ccc-resource/resource-layout/resource-layout.component.scss +26 -0
- package/src/ccc-resource/resource-layout/resource-layout.component.spec.ts +22 -0
- package/src/ccc-resource/resource-layout/resource-layout.component.ts +176 -0
- package/src/ccc-resource/resource-list/ resource-list.component.spec.ts +22 -0
- package/src/ccc-resource/resource-list/resource-list.component.html +27 -0
- package/src/ccc-resource/resource-list/resource-list.component.scss +67 -0
- package/src/ccc-resource/resource-list/resource-list.component.ts +376 -0
- package/src/ccc-resource/resource-list-create/resource-list-create.component.html +71 -0
- package/src/ccc-resource/resource-list-create/resource-list-create.component.scss +9 -0
- package/src/ccc-resource/resource-list-create/resource-list-create.component.spec.ts +22 -0
- package/src/ccc-resource/resource-list-create/resource-list-create.component.ts +103 -0
- package/src/ccc-resource/resource-resolver/resource-resolver.component.html +1 -0
- package/src/ccc-resource/resource-resolver/resource-resolver.component.scss +0 -0
- package/src/ccc-resource/resource-resolver/resource-resolver.component.spec.ts +22 -0
- package/src/ccc-resource/resource-resolver/resource-resolver.component.ts +69 -0
- package/src/ccc-resource/resource-store.service.ts +93 -0
- package/src/ccc-resource/resource-view/resource-view.component.html +133 -0
- package/src/ccc-resource/resource-view/resource-view.component.scss +150 -0
- package/src/ccc-resource/resource-view/resource-view.component.spec.ts +22 -0
- package/src/ccc-resource/resource-view/resource-view.component.ts +354 -0
- package/src/ccc-resource/resources-helpers.ts +262 -0
- package/src/ccc-resource/utils/validator-utils.ts +6 -0
- package/{fesm2022/cccteam-ccc-lib.mjs → src/index.ts} +30 -8
- package/src/internal-types/index.ts +1 -0
- package/src/internal-types/ng-package.json +6 -0
- package/src/types/auth.actions.ts +46 -0
- package/src/types/configs.ts +952 -0
- package/src/types/constants.ts +1 -0
- package/src/types/core.actions.ts +33 -0
- package/src/types/index.ts +9 -0
- package/src/types/ng-package.json +6 -0
- package/src/types/notification-message.ts +20 -0
- package/src/types/permissions.ts +17 -0
- package/src/types/session-info.ts +10 -0
- package/src/types/tokens.ts +20 -0
- package/src/ui-alert/alert.component.html +13 -0
- package/src/ui-alert/alert.component.scss +48 -0
- package/src/ui-alert/alert.component.spec.ts +22 -0
- package/src/ui-alert/alert.component.ts +35 -0
- package/src/ui-alert/index.ts +1 -0
- package/src/ui-alert/ng-package.json +6 -0
- package/src/ui-core-service/index.ts +1 -0
- package/src/ui-core-service/ng-package.json +6 -0
- package/src/ui-core-service/ui-core.service.ts +34 -0
- package/src/ui-interceptor/api.interceptor.spec.ts +16 -0
- package/src/ui-interceptor/api.interceptor.ts +45 -0
- package/src/ui-interceptor/index.ts +1 -0
- package/src/ui-interceptor/ng-package.json +6 -0
- package/src/ui-notification-service/index.ts +1 -0
- package/src/ui-notification-service/ng-package.json +6 -0
- package/src/ui-notification-service/notification.service.ts +59 -0
- package/src/ui-sidenav/index.ts +1 -0
- package/src/ui-sidenav/ng-package.json +6 -0
- package/src/ui-sidenav/sidenav.component.html +60 -0
- package/src/ui-sidenav/sidenav.component.scss +99 -0
- package/src/ui-sidenav/sidenav.component.spec.ts +22 -0
- package/src/ui-sidenav/sidenav.component.ts +64 -0
- package/src/util-request-options/index.ts +1 -0
- package/src/util-request-options/ng-package.json +6 -0
- package/src/util-request-options/request-options.ts +17 -0
- package/tsconfig.lib.json +13 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs +0 -36
- package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs +0 -25
- package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs +0 -117
- package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs +0 -44
- package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs +0 -88
- package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-types.mjs +0 -137
- package/fesm2022/cccteam-ccc-lib-src-types.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs +0 -48
- package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-core-service.mjs +0 -41
- package/fesm2022/cccteam-ccc-lib-src-ui-core-service.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs +0 -50
- package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs +0 -63
- package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs +0 -60
- package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-util-request-options.mjs +0 -19
- package/fesm2022/cccteam-ccc-lib-src-util-request-options.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib.mjs.map +0 -1
- package/index.d.ts +0 -12
- package/src/auth-authentication-guard/index.d.ts +0 -6
- package/src/auth-authorization-guard/index.d.ts +0 -6
- package/src/auth-forms/index.d.ts +0 -45
- package/src/auth-has-permission/index.d.ts +0 -15
- package/src/auth-service/index.d.ts +0 -36
- package/src/types/index.d.ts +0 -133
- package/src/ui-alert/index.d.ts +0 -16
- package/src/ui-core-service/index.d.ts +0 -20
- package/src/ui-interceptor/index.d.ts +0 -16
- package/src/ui-notification-service/index.d.ts +0 -33
- package/src/ui-sidenav/index.d.ts +0 -33
- package/src/util-request-options/index.d.ts +0 -12
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, computed, inject, Input, Signal } from '@angular/core';
|
|
3
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
4
|
+
import { MatExpansionModule } from '@angular/material/expansion';
|
|
5
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
6
|
+
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
7
|
+
import { RouterModule } from '@angular/router';
|
|
8
|
+
|
|
9
|
+
import { HasPermissionDirective } from '@cccteam/ccc-lib/src/auth-has-permission';
|
|
10
|
+
import { PermissionScope } from '@cccteam/ccc-lib/src/types';
|
|
11
|
+
import { UiCoreService } from '@cccteam/ccc-lib/src/ui-core-service';
|
|
12
|
+
|
|
13
|
+
export interface NavItem {
|
|
14
|
+
type: 'link' | 'header' | 'expandable';
|
|
15
|
+
routerLink?: string[];
|
|
16
|
+
label: string;
|
|
17
|
+
icon?: string;
|
|
18
|
+
permission?: PermissionScope;
|
|
19
|
+
children?: NavItem[];
|
|
20
|
+
isExpanded?: boolean;
|
|
21
|
+
attentionCount?: Signal<number>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type NavGroups = Record<string, NavItem[]>;
|
|
25
|
+
|
|
26
|
+
@Component({
|
|
27
|
+
selector: 'ccc-sidenav',
|
|
28
|
+
templateUrl: './sidenav.component.html',
|
|
29
|
+
styleUrls: ['./sidenav.component.scss'],
|
|
30
|
+
imports: [
|
|
31
|
+
MatIconModule,
|
|
32
|
+
RouterModule,
|
|
33
|
+
CommonModule,
|
|
34
|
+
MatExpansionModule,
|
|
35
|
+
MatButtonModule,
|
|
36
|
+
MatSidenavModule,
|
|
37
|
+
HasPermissionDirective,
|
|
38
|
+
],
|
|
39
|
+
})
|
|
40
|
+
export class SidenavComponent {
|
|
41
|
+
ui = inject(UiCoreService);
|
|
42
|
+
|
|
43
|
+
@Input() navGroups?: NavGroups;
|
|
44
|
+
currentNav = computed(() => {
|
|
45
|
+
return this.updateNavItems(this.ui.currentSidenavIdentifier());
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Updates the currentNav based on the identifier
|
|
50
|
+
* @param identifier
|
|
51
|
+
* @returns NavItem[]
|
|
52
|
+
* @memberof SidenavComponent
|
|
53
|
+
*/
|
|
54
|
+
updateNavItems(identifier: string): NavItem[] {
|
|
55
|
+
if (!this.navGroups) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
if (!this.navGroups[identifier]) {
|
|
59
|
+
// pick the first one if the identifier is not found so we don't break the UI
|
|
60
|
+
identifier = Object.keys(this.navGroups)[0];
|
|
61
|
+
}
|
|
62
|
+
return this.navGroups[identifier];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './request-options';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HttpContext, HttpContextToken } from '@angular/common/http';
|
|
2
|
+
|
|
3
|
+
export interface CustomHttpRequestOptions {
|
|
4
|
+
suppressGlobalError: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const CUSTOM_HTTP_REQUEST_OPTIONS = new HttpContextToken<CustomHttpRequestOptions>(() => ({
|
|
8
|
+
suppressGlobalError: false,
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
export function errorOptions(suppressGlobalError: boolean | undefined): { context: HttpContext } {
|
|
12
|
+
return {
|
|
13
|
+
context: new HttpContext().set(CUSTOM_HTTP_REQUEST_OPTIONS, {
|
|
14
|
+
suppressGlobalError: suppressGlobalError ?? false,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "../../tsconfig.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"outDir": "../../out-tsc/lib",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"inlineSources": true,
|
|
10
|
+
"types": []
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["**/*.spec.ts"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "./tsconfig.lib.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"declarationMap": false
|
|
7
|
+
},
|
|
8
|
+
"angularCompilerOptions": {
|
|
9
|
+
"compilationMode": "partial"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "../../tsconfig.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"outDir": "../../out-tsc/spec",
|
|
7
|
+
"types": [
|
|
8
|
+
"jasmine"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
"**/*.spec.ts",
|
|
13
|
+
"**/*.d.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { inject } from '@angular/core';
|
|
2
|
-
import { AuthService } from '@cccteam/ccc-lib/src/auth-service';
|
|
3
|
-
import { BASE_URL } from '@cccteam/ccc-lib/src/types';
|
|
4
|
-
import { of } from 'rxjs';
|
|
5
|
-
import { map, catchError } from 'rxjs/operators';
|
|
6
|
-
|
|
7
|
-
const AuthenticationGuard = (route, routerState) => {
|
|
8
|
-
const authService = inject(AuthService);
|
|
9
|
-
const baseUrl = inject(BASE_URL);
|
|
10
|
-
const authenticate = () => {
|
|
11
|
-
const url = routerState.url;
|
|
12
|
-
const absoluteUrl = baseUrl + (!url.toString().startsWith('/') ? '/' + url : url);
|
|
13
|
-
const encodedUrl = encodeURIComponent(absoluteUrl);
|
|
14
|
-
window.location.href = `${authService.loginRoute()}?returnUrl=${encodedUrl}`;
|
|
15
|
-
};
|
|
16
|
-
if (authService.authenticated()) {
|
|
17
|
-
return of(true);
|
|
18
|
-
}
|
|
19
|
-
return authService.checkUserSession().pipe(map((sessionInfo) => {
|
|
20
|
-
if (sessionInfo?.authenticated) {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
authenticate();
|
|
24
|
-
return false;
|
|
25
|
-
}), catchError(() => {
|
|
26
|
-
authenticate();
|
|
27
|
-
return of(false);
|
|
28
|
-
}));
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Generated bundle index. Do not edit.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
export { AuthenticationGuard };
|
|
36
|
-
//# sourceMappingURL=cccteam-ccc-lib-src-auth-authentication-guard.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cccteam-ccc-lib-src-auth-authentication-guard.mjs","sources":["../../../projects/ccc-lib/src/auth-authentication-guard/authentication.guard.ts","../../../projects/ccc-lib/src/auth-authentication-guard/cccteam-ccc-lib-src-auth-authentication-guard.ts"],"sourcesContent":["import { inject } from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\nimport { AuthService } from '@cccteam/ccc-lib/src/auth-service';\nimport { BASE_URL } from '@cccteam/ccc-lib/src/types';\nimport { Observable, of } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\nexport const AuthenticationGuard = (\n route: ActivatedRouteSnapshot,\n routerState: RouterStateSnapshot,\n): Observable<boolean> => {\n const authService = inject(AuthService);\n const baseUrl = inject(BASE_URL);\n\n const authenticate = (): void => {\n const url = routerState.url;\n const absoluteUrl = baseUrl + (!url.toString().startsWith('/') ? '/' + url : url);\n const encodedUrl = encodeURIComponent(absoluteUrl);\n window.location.href = `${authService.loginRoute()}?returnUrl=${encodedUrl}`;\n };\n\n if (authService.authenticated()) {\n return of(true);\n }\n\n return authService.checkUserSession().pipe(\n map((sessionInfo) => {\n if (sessionInfo?.authenticated) {\n return true;\n }\n\n authenticate();\n return false;\n }),\n catchError(() => {\n authenticate();\n return of(false);\n }),\n );\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAOa,mBAAmB,GAAG,CACjC,KAA6B,EAC7B,WAAgC,KACT;AACvB,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AACvC,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC;IAEhC,MAAM,YAAY,GAAG,MAAW;AAC9B,QAAA,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG;QAC3B,MAAM,WAAW,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACjF,QAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,WAAW,CAAC;AAClD,QAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAA,EAAG,WAAW,CAAC,UAAU,EAAE,CAAc,WAAA,EAAA,UAAU,EAAE;AAC9E,KAAC;AAED,IAAA,IAAI,WAAW,CAAC,aAAa,EAAE,EAAE;AAC/B,QAAA,OAAO,EAAE,CAAC,IAAI,CAAC;;AAGjB,IAAA,OAAO,WAAW,CAAC,gBAAgB,EAAE,CAAC,IAAI,CACxC,GAAG,CAAC,CAAC,WAAW,KAAI;AAClB,QAAA,IAAI,WAAW,EAAE,aAAa,EAAE;AAC9B,YAAA,OAAO,IAAI;;AAGb,QAAA,YAAY,EAAE;AACd,QAAA,OAAO,KAAK;AACd,KAAC,CAAC,EACF,UAAU,CAAC,MAAK;AACd,QAAA,YAAY,EAAE;AACd,QAAA,OAAO,EAAE,CAAC,KAAK,CAAC;KACjB,CAAC,CACH;AACH;;ACvCA;;AAEG;;;;"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { inject, computed } from '@angular/core';
|
|
2
|
-
import { Router } from '@angular/router';
|
|
3
|
-
import { AuthService } from '@cccteam/ccc-lib/src/auth-service';
|
|
4
|
-
|
|
5
|
-
const AuthorizationGuard = (route) => {
|
|
6
|
-
const router = inject(Router);
|
|
7
|
-
const auth = inject(AuthService);
|
|
8
|
-
return computed(() => {
|
|
9
|
-
const hasPermission = auth.hasPermission(route.data['scope']);
|
|
10
|
-
if (hasPermission) {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
router.navigate(['/']);
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Generated bundle index. Do not edit.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
export { AuthorizationGuard };
|
|
25
|
-
//# sourceMappingURL=cccteam-ccc-lib-src-auth-authorization-guard.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cccteam-ccc-lib-src-auth-authorization-guard.mjs","sources":["../../../projects/ccc-lib/src/auth-authorization-guard/authorization.guard.ts","../../../projects/ccc-lib/src/auth-authorization-guard/cccteam-ccc-lib-src-auth-authorization-guard.ts"],"sourcesContent":["import { computed, inject, Signal } from '@angular/core';\nimport { ActivatedRouteSnapshot, Router } from '@angular/router';\nimport { AuthService } from '@cccteam/ccc-lib/src/auth-service';\n\nexport const AuthorizationGuard = (route: ActivatedRouteSnapshot): Signal<boolean> => {\n const router = inject(Router);\n const auth = inject(AuthService);\n return computed(() => {\n const hasPermission = auth.hasPermission(route.data['scope']);\n if (hasPermission) {\n return true;\n } else {\n router.navigate(['/']);\n return false;\n }\n });\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAIa,MAAA,kBAAkB,GAAG,CAAC,KAA6B,KAAqB;AACnF,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAC7B,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;IAChC,OAAO,QAAQ,CAAC,MAAK;AACnB,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7D,IAAI,aAAa,EAAE;AACjB,YAAA,OAAO,IAAI;;aACN;AACL,YAAA,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;AACtB,YAAA,OAAO,KAAK;;AAEhB,KAAC,CAAC;AACJ;;AChBA;;AAEG;;;;"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, signal, computed, Component } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/material/form-field';
|
|
4
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
|
-
import * as i2 from '@angular/material/input';
|
|
6
|
-
import { MatInputModule } from '@angular/material/input';
|
|
7
|
-
import { AuthService } from '@cccteam/ccc-lib/src/auth-service';
|
|
8
|
-
import { ReadPermission, UpdatePermission } from '@cccteam/ccc-lib/src/types';
|
|
9
|
-
import { isEqual } from 'lodash-es';
|
|
10
|
-
|
|
11
|
-
var InputMode;
|
|
12
|
-
(function (InputMode) {
|
|
13
|
-
InputMode["Read"] = "read";
|
|
14
|
-
InputMode["Edit"] = "edit";
|
|
15
|
-
})(InputMode || (InputMode = {}));
|
|
16
|
-
class CccInputFieldComponent {
|
|
17
|
-
auth = inject(AuthService);
|
|
18
|
-
className = input();
|
|
19
|
-
mode = input.required();
|
|
20
|
-
resource = input.required();
|
|
21
|
-
domain = input.required();
|
|
22
|
-
value = input.required();
|
|
23
|
-
name = input.required();
|
|
24
|
-
inputMode = InputMode;
|
|
25
|
-
canEdit = signal(false);
|
|
26
|
-
canEditSelector = false;
|
|
27
|
-
canRead = signal(false);
|
|
28
|
-
canReadSelector = false;
|
|
29
|
-
ngOnInit() {
|
|
30
|
-
this.canEditSelector = this.auth.hasPermission({
|
|
31
|
-
resource: this.resource(),
|
|
32
|
-
permission: ReadPermission,
|
|
33
|
-
domain: this.domain(),
|
|
34
|
-
});
|
|
35
|
-
this.canReadSelector = this.auth.hasPermission({
|
|
36
|
-
resource: this.resource(),
|
|
37
|
-
permission: UpdatePermission,
|
|
38
|
-
domain: this.domain(),
|
|
39
|
-
});
|
|
40
|
-
this.canRead = computed(() => {
|
|
41
|
-
const res = this.resource();
|
|
42
|
-
if (!res) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
if (AuthService.requiresPermission(this.resource(), ReadPermission)) {
|
|
46
|
-
return this.canReadSelector;
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
});
|
|
50
|
-
this.canEdit = computed(() => {
|
|
51
|
-
const res = this.resource();
|
|
52
|
-
if (!res) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
if (AuthService.requiresPermission(this.resource(), UpdatePermission)) {
|
|
56
|
-
return this.canEditSelector;
|
|
57
|
-
}
|
|
58
|
-
return false;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CccInputFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
62
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.0", type: CccInputFieldComponent, isStandalone: true, selector: "ccc-input-field", inputs: { className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: true, transformFunction: null }, resource: { classPropertyName: "resource", publicName: "resource", isSignal: true, isRequired: true, transformFunction: null }, domain: { classPropertyName: "domain", publicName: "domain", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
63
|
-
<mat-form-field [class]="className()">
|
|
64
|
-
<mat-label>{{ name() }}</mat-label>
|
|
65
|
-
<input matInput [disabled]="mode() === inputMode.Edit && canEdit()" [value]="value()" />
|
|
66
|
-
</mat-form-field>
|
|
67
|
-
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }] });
|
|
68
|
-
}
|
|
69
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CccInputFieldComponent, decorators: [{
|
|
70
|
-
type: Component,
|
|
71
|
-
args: [{ selector: 'ccc-input-field', imports: [MatFormFieldModule, MatInputModule], template: `
|
|
72
|
-
<mat-form-field [class]="className()">
|
|
73
|
-
<mat-label>{{ name() }}</mat-label>
|
|
74
|
-
<input matInput [disabled]="mode() === inputMode.Edit && canEdit()" [value]="value()" />
|
|
75
|
-
</mat-form-field>
|
|
76
|
-
` }]
|
|
77
|
-
}] });
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Accepts a FormGroup and compares it to an object to return the dirty form values
|
|
81
|
-
* as a sparse object
|
|
82
|
-
* @param form - FormGroup
|
|
83
|
-
* @param compareData - object to compare form values against
|
|
84
|
-
* @returns Partial<T>
|
|
85
|
-
* @example sparseFormData<UserCreate>(this.userForm, initUser)
|
|
86
|
-
*/
|
|
87
|
-
function sparseFormData(form, compareData) {
|
|
88
|
-
const sparseFormData = {};
|
|
89
|
-
for (const [key, control] of Object.entries(form.controls)) {
|
|
90
|
-
const controlValue = control.value;
|
|
91
|
-
const compareValue = compareData[key];
|
|
92
|
-
if (!isEqual(controlValue, compareValue)) {
|
|
93
|
-
sparseFormData[key] = controlValue;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return sparseFormData;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Accepts a FormArray and removes empty strings
|
|
100
|
-
* @param formArray - FormArray
|
|
101
|
-
* @returns FormArray
|
|
102
|
-
*/
|
|
103
|
-
function cleanStringFormArray(formArray) {
|
|
104
|
-
for (let i = formArray.controls.length - 1; i >= 0; i--) {
|
|
105
|
-
if (formArray.at(i).value === '') {
|
|
106
|
-
formArray.removeAt(i);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return formArray;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Generated bundle index. Do not edit.
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
export { CccInputFieldComponent, InputMode, cleanStringFormArray, sparseFormData };
|
|
117
|
-
//# sourceMappingURL=cccteam-ccc-lib-src-auth-forms.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cccteam-ccc-lib-src-auth-forms.mjs","sources":["../../../projects/ccc-lib/src/auth-forms/ccc-field/ccc-field.component.ts","../../../projects/ccc-lib/src/auth-forms/form-helpers.ts","../../../projects/ccc-lib/src/auth-forms/cccteam-ccc-lib-src-auth-forms.ts"],"sourcesContent":["import { Component, computed, inject, input, OnInit, signal, Signal } from '@angular/core';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { AuthService } from '@cccteam/ccc-lib/src/auth-service';\nimport { Domain, ReadPermission, Resource, UpdatePermission } from '@cccteam/ccc-lib/src/types';\n\nexport enum InputMode {\n Read = 'read',\n Edit = 'edit',\n}\n\n@Component({\n selector: 'ccc-input-field',\n imports: [MatFormFieldModule, MatInputModule],\n template: `\n <mat-form-field [class]=\"className()\">\n <mat-label>{{ name() }}</mat-label>\n <input matInput [disabled]=\"mode() === inputMode.Edit && canEdit()\" [value]=\"value()\" />\n </mat-form-field>\n `,\n styleUrl: './ccc-field.component.scss',\n})\nexport class CccInputFieldComponent implements OnInit {\n auth = inject(AuthService);\n className = input();\n mode = input.required<InputMode>();\n resource = input.required<Resource>();\n domain = input.required<Domain>();\n value = input.required();\n name = input.required<string>();\n\n inputMode = InputMode;\n\n canEdit: Signal<boolean> = signal(false);\n canEditSelector = false;\n\n canRead: Signal<boolean> = signal(false);\n canReadSelector = false;\n\n ngOnInit(): void {\n this.canEditSelector = this.auth.hasPermission({\n resource: this.resource(),\n permission: ReadPermission,\n domain: this.domain(),\n });\n this.canReadSelector = this.auth.hasPermission({\n resource: this.resource(),\n permission: UpdatePermission,\n domain: this.domain(),\n });\n\n this.canRead = computed(() => {\n const res = this.resource();\n if (!res) {\n return false;\n }\n if (AuthService.requiresPermission(this.resource(), ReadPermission)) {\n return this.canReadSelector;\n }\n return false;\n });\n\n this.canEdit = computed(() => {\n const res = this.resource();\n if (!res) {\n return false;\n }\n if (AuthService.requiresPermission(this.resource(), UpdatePermission)) {\n return this.canEditSelector;\n }\n return false;\n });\n }\n}\n","import { FormArray, FormGroup } from '@angular/forms';\nimport { isEqual } from 'lodash-es';\n\n/**\n * Accepts a FormGroup and compares it to an object to return the dirty form values\n * as a sparse object\n * @param form - FormGroup\n * @param compareData - object to compare form values against\n * @returns Partial<T>\n * @example sparseFormData<UserCreate>(this.userForm, initUser)\n */\nexport function sparseFormData<T>(form: FormGroup, compareData: T): T {\n const sparseFormData: T = {} as T;\n\n for (const [key, control] of Object.entries(form.controls)) {\n const controlValue = control.value;\n const compareValue = compareData[key as keyof T];\n\n if (!isEqual(controlValue, compareValue)) {\n sparseFormData[key as keyof T] = controlValue as T[keyof T];\n }\n }\n\n return sparseFormData;\n}\n\n/**\n * Accepts a FormArray and removes empty strings\n * @param formArray - FormArray\n * @returns FormArray\n */\nexport function cleanStringFormArray(formArray: FormArray): FormArray {\n for (let i = formArray.controls.length - 1; i >= 0; i--) {\n if (formArray.at(i).value === '') {\n formArray.removeAt(i);\n }\n }\n return formArray;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;IAMY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,GAGpB,EAAA,CAAA,CAAA;MAaY,sBAAsB,CAAA;AACjC,IAAA,IAAI,GAAG,MAAM,CAAC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,CAAC,EAAE;AAC1D,QAAA,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK;AAClC,QAAA,MAAM,YAAY,GAAG,WAAW,CAAC,GAAc,CAAC;QAEhD,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE;AACxC,YAAA,cAAc,CAAC,GAAc,CAAC,GAAG,YAA0B;;;AAI/D,IAAA,OAAO,cAAc;AACvB;AAEA;;;;AAIG;AACG,SAAU,oBAAoB,CAAC,SAAoB,EAAA;AACvD,IAAA,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACvD,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,EAAE;AAChC,YAAA,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;;;AAGzB,IAAA,OAAO,SAAS;AAClB;;ACtCA;;AAEG;;;;"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, TemplateRef, ViewContainerRef, signal, effect, Input, Directive } from '@angular/core';
|
|
3
|
-
import { AuthService } from '@cccteam/ccc-lib/src/auth-service';
|
|
4
|
-
|
|
5
|
-
class HasPermissionDirective {
|
|
6
|
-
auth = inject(AuthService);
|
|
7
|
-
templateRef = inject((TemplateRef));
|
|
8
|
-
viewContainer = inject(ViewContainerRef);
|
|
9
|
-
scope = signal(undefined);
|
|
10
|
-
set cccHasPermission(scope) {
|
|
11
|
-
this.scope.set(scope);
|
|
12
|
-
}
|
|
13
|
-
constructor() {
|
|
14
|
-
effect(() => {
|
|
15
|
-
const scope = this.scope();
|
|
16
|
-
if (this.auth.hasPermission(scope) && this.auth.authenticated()) {
|
|
17
|
-
if (!this.viewContainer.get(0)) {
|
|
18
|
-
this.viewContainer.createEmbeddedView(this.templateRef);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
this.viewContainer.clear();
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: HasPermissionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
27
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: HasPermissionDirective, isStandalone: true, selector: "[cccHasPermission]", inputs: { cccHasPermission: "cccHasPermission" }, ngImport: i0 });
|
|
28
|
-
}
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: HasPermissionDirective, decorators: [{
|
|
30
|
-
type: Directive,
|
|
31
|
-
args: [{
|
|
32
|
-
selector: '[cccHasPermission]',
|
|
33
|
-
standalone: true,
|
|
34
|
-
}]
|
|
35
|
-
}], ctorParameters: () => [], propDecorators: { cccHasPermission: [{
|
|
36
|
-
type: Input
|
|
37
|
-
}] } });
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Generated bundle index. Do not edit.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
export { HasPermissionDirective };
|
|
44
|
-
//# sourceMappingURL=cccteam-ccc-lib-src-auth-has-permission.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cccteam-ccc-lib-src-auth-has-permission.mjs","sources":["../../../projects/ccc-lib/src/auth-has-permission/has-permission.directive.ts","../../../projects/ccc-lib/src/auth-has-permission/cccteam-ccc-lib-src-auth-has-permission.ts"],"sourcesContent":["import { Directive, Input, TemplateRef, ViewContainerRef, effect, inject, signal } from '@angular/core';\nimport { AuthService } from '@cccteam/ccc-lib/src/auth-service';\nimport { PermissionScope } from '@cccteam/ccc-lib/src/types';\n\n@Directive({\n selector: '[cccHasPermission]',\n standalone: true,\n})\nexport class HasPermissionDirective {\n private auth = inject(AuthService);\n private templateRef = inject(TemplateRef<unknown>);\n private viewContainer = inject(ViewContainerRef);\n\n private scope = signal<PermissionScope | undefined>(undefined);\n\n @Input()\n set cccHasPermission(scope: PermissionScope) {\n this.scope.set(scope);\n }\n\n constructor() {\n effect(() => {\n const scope = this.scope();\n\n if (this.auth.hasPermission(scope) && this.auth.authenticated()) {\n if (!this.viewContainer.get(0)) {\n this.viewContainer.createEmbeddedView(this.templateRef);\n }\n } else {\n this.viewContainer.clear();\n }\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAQa,sBAAsB,CAAA;AACzB,IAAA,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;AAC1B,IAAA,WAAW,GAAG,MAAM,EAAC,WAAoB,EAAC;AAC1C,IAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAExC,IAAA,KAAK,GAAG,MAAM,CAA8B,SAAS,CAAC;IAE9D,IACI,gBAAgB,CAAC,KAAsB,EAAA;AACzC,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;;AAGvB,IAAA,WAAA,GAAA;QACE,MAAM,CAAC,MAAK;AACV,YAAA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE;AAE1B,YAAA,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE;gBAC/D,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;oBAC9B,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC;;;iBAEpD;AACL,gBAAA,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;;AAE9B,SAAC,CAAC;;uGAvBO,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,gBAAA,EAAA,kBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;wDASK,gBAAgB,EAAA,CAAA;sBADnB;;;ACfH;;AAEG;;;;"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, signal, Inject, Injectable } from '@angular/core';
|
|
4
|
-
import { PERMISSION_REQUIRED, API_URL } from '@cccteam/ccc-lib/src/types';
|
|
5
|
-
import { errorOptions } from '@cccteam/ccc-lib/src/util-request-options';
|
|
6
|
-
import { map, tap } from 'rxjs';
|
|
7
|
-
|
|
8
|
-
const routes = {
|
|
9
|
-
login: (rootUrl) => `${rootUrl}/user/login`,
|
|
10
|
-
session: (rootUrl) => `${rootUrl}/user/session`,
|
|
11
|
-
};
|
|
12
|
-
class AuthService {
|
|
13
|
-
apiUrl;
|
|
14
|
-
http = inject(HttpClient);
|
|
15
|
-
authenticatedSignal = signal(false);
|
|
16
|
-
sessionInfoSignal = signal({});
|
|
17
|
-
redirectUrl = signal('');
|
|
18
|
-
authenticated = this.authenticatedSignal.asReadonly();
|
|
19
|
-
sessionInfo = this.sessionInfoSignal.asReadonly();
|
|
20
|
-
constructor(apiUrl) {
|
|
21
|
-
this.apiUrl = apiUrl;
|
|
22
|
-
this.initializePermissionFn();
|
|
23
|
-
}
|
|
24
|
-
static permissionFn;
|
|
25
|
-
hasPermission(scope) {
|
|
26
|
-
if (!scope)
|
|
27
|
-
return true;
|
|
28
|
-
const resourcePermissions = this.sessionInfo().permissions?.[scope.domain]?.[scope.resource];
|
|
29
|
-
return Array.isArray(resourcePermissions) && resourcePermissions.includes(scope.permission);
|
|
30
|
-
}
|
|
31
|
-
static requiresPermission(resource, permission) {
|
|
32
|
-
if (!AuthService.permissionFn) {
|
|
33
|
-
throw new Error(`AuthState has not been initialized. Ensure AuthState is provided in your module or instantiated at least once.`);
|
|
34
|
-
}
|
|
35
|
-
return AuthService.permissionFn(resource, permission);
|
|
36
|
-
}
|
|
37
|
-
initializePermissionFn() {
|
|
38
|
-
if (!AuthService.permissionFn) {
|
|
39
|
-
AuthService.permissionFn = inject(PERMISSION_REQUIRED);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Logs a user out.
|
|
44
|
-
*
|
|
45
|
-
* @returns Observable with a boolean indicating whether they were logged out.
|
|
46
|
-
*/
|
|
47
|
-
logout() {
|
|
48
|
-
return this.http
|
|
49
|
-
.delete(routes.session(this.apiUrl), errorOptions(false))
|
|
50
|
-
.pipe(map(() => true))
|
|
51
|
-
.pipe(tap(() => {
|
|
52
|
-
this.authenticatedSignal.set(false);
|
|
53
|
-
this.sessionInfoSignal.set({});
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Checks a user's session with the server.
|
|
58
|
-
*
|
|
59
|
-
* @returns Observable with the user session info
|
|
60
|
-
*/
|
|
61
|
-
checkUserSession() {
|
|
62
|
-
return this.http.get(routes.session(this.apiUrl), errorOptions(false)).pipe(tap((sessionInfo) => {
|
|
63
|
-
this.authenticatedSignal.set(!!sessionInfo?.authenticated);
|
|
64
|
-
this.sessionInfoSignal.set(sessionInfo);
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
loginRoute() {
|
|
68
|
-
return routes.login(this.apiUrl);
|
|
69
|
-
}
|
|
70
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: AuthService, deps: [{ token: API_URL }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
71
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
72
|
-
}
|
|
73
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: AuthService, decorators: [{
|
|
74
|
-
type: Injectable,
|
|
75
|
-
args: [{
|
|
76
|
-
providedIn: 'root',
|
|
77
|
-
}]
|
|
78
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
79
|
-
type: Inject,
|
|
80
|
-
args: [API_URL]
|
|
81
|
-
}] }] });
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Generated bundle index. Do not edit.
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
export { AuthService };
|
|
88
|
-
//# sourceMappingURL=cccteam-ccc-lib-src-auth-service.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cccteam-ccc-lib-src-auth-service.mjs","sources":["../../../projects/ccc-lib/src/auth-service/auth.service.ts","../../../projects/ccc-lib/src/auth-service/cccteam-ccc-lib-src-auth-service.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { inject, Inject, Injectable, signal } from '@angular/core';\nimport {\n API_URL,\n Permission,\n PERMISSION_REQUIRED,\n PermissionScope,\n Resource,\n SessionInfo,\n} from '@cccteam/ccc-lib/src/types';\nimport { errorOptions } from '@cccteam/ccc-lib/src/util-request-options';\nimport { map, Observable, tap } from 'rxjs';\n\nconst routes = {\n login: (rootUrl: string): string => `${rootUrl}/user/login`,\n session: (rootUrl: string): string => `${rootUrl}/user/session`,\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthService {\n http = inject(HttpClient);\n private authenticatedSignal = signal(false);\n private sessionInfoSignal = signal({} as SessionInfo);\n\n redirectUrl = signal('');\n authenticated = this.authenticatedSignal.asReadonly();\n sessionInfo = this.sessionInfoSignal.asReadonly();\n\n constructor(@Inject(API_URL) private apiUrl: string) {\n this.initializePermissionFn();\n }\n\n private static permissionFn: (resource: Resource, permission: Permission) => boolean;\n\n hasPermission(scope?: PermissionScope): boolean {\n if (!scope) return true;\n const resourcePermissions = this.sessionInfo().permissions?.[scope.domain]?.[scope.resource];\n return Array.isArray(resourcePermissions) && resourcePermissions.includes(scope.permission);\n }\n\n static requiresPermission(resource: Resource, permission: Permission): boolean {\n if (!AuthService.permissionFn) {\n throw new Error(\n `AuthState has not been initialized. Ensure AuthState is provided in your module or instantiated at least once.`,\n );\n }\n return AuthService.permissionFn(resource, permission);\n }\n\n private initializePermissionFn(): void {\n if (!AuthService.permissionFn) {\n AuthService.permissionFn = inject(PERMISSION_REQUIRED);\n }\n }\n\n /**\n * Logs a user out.\n *\n * @returns Observable with a boolean indicating whether they were logged out.\n */\n logout(): Observable<boolean> {\n return this.http\n .delete(routes.session(this.apiUrl), errorOptions(false))\n .pipe(map(() => true))\n .pipe(\n tap(() => {\n this.authenticatedSignal.set(false);\n this.sessionInfoSignal.set({} as SessionInfo);\n }),\n );\n }\n\n /**\n * Checks a user's session with the server.\n *\n * @returns Observable with the user session info\n */\n checkUserSession(): Observable<SessionInfo> {\n return this.http.get<SessionInfo>(routes.session(this.apiUrl), errorOptions(false)).pipe(\n tap((sessionInfo) => {\n this.authenticatedSignal.set(!!sessionInfo?.authenticated);\n this.sessionInfoSignal.set(sessionInfo);\n }),\n );\n }\n\n loginRoute(): string {\n return routes.login(this.apiUrl);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAaA,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,CAAC,OAAe,KAAa,CAAA,EAAG,OAAO,CAAa,WAAA,CAAA;IAC3D,OAAO,EAAE,CAAC,OAAe,KAAa,CAAA,EAAG,OAAO,CAAe,aAAA,CAAA;CAChE;MAKY,WAAW,CAAA;AAS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AAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;0BAUc,MAAM;2BAAC,OAAO;;;AC9B7B;;AAEG;;;;"}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
|
-
// no-namespace rule is disabled because action hygiene prevents import pollution
|
|
5
|
-
var AuthenticationGuardAction;
|
|
6
|
-
(function (AuthenticationGuardAction) {
|
|
7
|
-
class SetRedirectUrl {
|
|
8
|
-
redirectUrl;
|
|
9
|
-
static type = '[AuthenticationGuard] Set Redirect Url And Navigate To Login Page';
|
|
10
|
-
constructor(redirectUrl) {
|
|
11
|
-
this.redirectUrl = redirectUrl;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
AuthenticationGuardAction.SetRedirectUrl = SetRedirectUrl;
|
|
15
|
-
class CheckUserSession {
|
|
16
|
-
static type = '[AuthenticationGuard] Check User Session';
|
|
17
|
-
}
|
|
18
|
-
AuthenticationGuardAction.CheckUserSession = CheckUserSession;
|
|
19
|
-
})(AuthenticationGuardAction || (AuthenticationGuardAction = {}));
|
|
20
|
-
var LoginAction;
|
|
21
|
-
(function (LoginAction) {
|
|
22
|
-
class Logout {
|
|
23
|
-
static type = '[Login] Auto Logout';
|
|
24
|
-
}
|
|
25
|
-
LoginAction.Logout = Logout;
|
|
26
|
-
class SetRedirectUrl {
|
|
27
|
-
redirectUrl;
|
|
28
|
-
static type = '[Login] Set Redirect Url';
|
|
29
|
-
constructor(redirectUrl) {
|
|
30
|
-
this.redirectUrl = redirectUrl;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
LoginAction.SetRedirectUrl = SetRedirectUrl;
|
|
34
|
-
class PublishError {
|
|
35
|
-
message;
|
|
36
|
-
static type = '[Login] Publish Error';
|
|
37
|
-
constructor(message) {
|
|
38
|
-
this.message = message;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
LoginAction.PublishError = PublishError;
|
|
42
|
-
})(LoginAction || (LoginAction = {}));
|
|
43
|
-
var AppAction;
|
|
44
|
-
(function (AppAction) {
|
|
45
|
-
class CheckUserSession {
|
|
46
|
-
static type = '[App] Check User Session';
|
|
47
|
-
}
|
|
48
|
-
AppAction.CheckUserSession = CheckUserSession;
|
|
49
|
-
class SetRedirectUrl {
|
|
50
|
-
redirectUrl;
|
|
51
|
-
static type = '[App] Set Redirect Url';
|
|
52
|
-
constructor(redirectUrl) {
|
|
53
|
-
this.redirectUrl = redirectUrl;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
AppAction.SetRedirectUrl = SetRedirectUrl;
|
|
57
|
-
class SetNavIdentifier {
|
|
58
|
-
identifier;
|
|
59
|
-
static type = '[App] Set Nav Identifier';
|
|
60
|
-
constructor(identifier) {
|
|
61
|
-
this.identifier = identifier;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
AppAction.SetNavIdentifier = SetNavIdentifier;
|
|
65
|
-
})(AppAction || (AppAction = {}));
|
|
66
|
-
|
|
67
|
-
/* eslint-disable @typescript-eslint/no-namespace */
|
|
68
|
-
// no-namespace rule is disabled because action hygiene prevents import pollution
|
|
69
|
-
var ApiInterceptorAction;
|
|
70
|
-
(function (ApiInterceptorAction) {
|
|
71
|
-
class BeginActivity {
|
|
72
|
-
process;
|
|
73
|
-
static type = '[ApiInterceptor] Add Loading Activity';
|
|
74
|
-
constructor(process) {
|
|
75
|
-
this.process = process;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
ApiInterceptorAction.BeginActivity = BeginActivity;
|
|
79
|
-
class EndActivity {
|
|
80
|
-
process;
|
|
81
|
-
static type = '[ApiInterceptor] Remove Loading Activity';
|
|
82
|
-
constructor(process) {
|
|
83
|
-
this.process = process;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
ApiInterceptorAction.EndActivity = EndActivity;
|
|
87
|
-
class PublishError {
|
|
88
|
-
message;
|
|
89
|
-
static type = '[ApiInterceptor] Publish Error';
|
|
90
|
-
constructor(message) {
|
|
91
|
-
this.message = message;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
ApiInterceptorAction.PublishError = PublishError;
|
|
95
|
-
class SetRedirectUrl {
|
|
96
|
-
redirectUrl;
|
|
97
|
-
static type = '[ApiInterceptor] Set Redirect Url';
|
|
98
|
-
constructor(redirectUrl) {
|
|
99
|
-
this.redirectUrl = redirectUrl;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
ApiInterceptorAction.SetRedirectUrl = SetRedirectUrl;
|
|
103
|
-
})(ApiInterceptorAction || (ApiInterceptorAction = {}));
|
|
104
|
-
var HeaderAction;
|
|
105
|
-
(function (HeaderAction) {
|
|
106
|
-
class ToggleSidenav {
|
|
107
|
-
static type = '[Header] Toggle Sidenav';
|
|
108
|
-
}
|
|
109
|
-
HeaderAction.ToggleSidenav = ToggleSidenav;
|
|
110
|
-
class Logout {
|
|
111
|
-
static type = '[Header] User Logout';
|
|
112
|
-
}
|
|
113
|
-
HeaderAction.Logout = Logout;
|
|
114
|
-
})(HeaderAction || (HeaderAction = {}));
|
|
115
|
-
|
|
116
|
-
var AlertLevel;
|
|
117
|
-
(function (AlertLevel) {
|
|
118
|
-
AlertLevel["ERROR"] = "warn";
|
|
119
|
-
AlertLevel["INFO"] = "accent";
|
|
120
|
-
AlertLevel["SUCCESS"] = "success";
|
|
121
|
-
})(AlertLevel || (AlertLevel = {}));
|
|
122
|
-
|
|
123
|
-
const ReadPermission = 'Read';
|
|
124
|
-
const UpdatePermission = 'Update';
|
|
125
|
-
|
|
126
|
-
const BASE_URL = new InjectionToken('BASE_URL');
|
|
127
|
-
const API_URL = new InjectionToken('API_URL');
|
|
128
|
-
const PERMISSION_REQUIRED = new InjectionToken('PERMISSION_REQUIRED');
|
|
129
|
-
const AVAILABLE_PERMISSIONS = new InjectionToken('AVAILABLE_PERMISSIONS');
|
|
130
|
-
const AVAILABLE_DOMAINS = new InjectionToken('AVAILABLE_DOMAINS');
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Generated bundle index. Do not edit.
|
|
134
|
-
*/
|
|
135
|
-
|
|
136
|
-
export { API_URL, AVAILABLE_DOMAINS, AVAILABLE_PERMISSIONS, AlertLevel, ApiInterceptorAction, AppAction, AuthenticationGuardAction, BASE_URL, HeaderAction, LoginAction, PERMISSION_REQUIRED, ReadPermission, UpdatePermission };
|
|
137
|
-
//# sourceMappingURL=cccteam-ccc-lib-src-types.mjs.map
|