@mediusinc/mng-commons 0.9.7 → 0.10.0
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/api/services/crud-api.abstract.service.mjs +2 -1
- package/esm2020/lib/api/services/get-all-api.abstract.service.mjs +1 -1
- package/esm2020/lib/components/action/action.component.mjs +39 -17
- package/esm2020/lib/components/action/editor/action-editor.component.mjs +2 -2
- package/esm2020/lib/components/action/models/action-execution.model.mjs +2 -1
- package/esm2020/lib/components/form/autocomplete/autocomplete.component.mjs +4 -2
- package/esm2020/lib/components/form/dropdown/dropdown.component.mjs +2 -1
- package/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +2 -1
- package/esm2020/lib/components/layout/menu-item.component.mjs +41 -19
- package/esm2020/lib/components/tableview/route/tableview-route.component.mjs +9 -9
- package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +1 -1
- package/esm2020/lib/descriptors/action.descriptor.mjs +23 -1
- package/esm2020/lib/descriptors/types/table.type.mjs +1 -1
- package/esm2020/lib/mng-commons.module.mjs +5 -1
- package/esm2020/lib/models/menu.model.mjs +1 -1
- package/esm2020/lib/router/index.mjs +2 -1
- package/esm2020/lib/router/models/router.model.mjs +1 -1
- package/esm2020/lib/router/route-builder.mjs +63 -69
- package/esm2020/lib/router/tableview-route-builder.mjs +160 -0
- package/esm2020/lib/security/authorization.guard.mjs +26 -0
- package/esm2020/lib/security/authorization.service.mjs +47 -0
- package/esm2020/lib/security/authorization.util.mjs +16 -0
- package/esm2020/lib/security/index.mjs +4 -0
- package/esm2020/lib/security/model/authorization.type.mjs +8 -0
- package/esm2020/lib/security/model/index.mjs +4 -0
- package/esm2020/lib/security/model/permission-service.interface.mjs +2 -0
- package/esm2020/lib/security/model/permissions.model.mjs +95 -0
- package/esm2020/lib/services/action-executor.service.mjs +2 -2
- package/esm2020/lib/services/commons.service.mjs +13 -1
- package/esm2020/lib/services/configuration.service.mjs +2 -2
- package/esm2020/lib/services/version.service.mjs +2 -1
- package/esm2020/lib/utils/action-data-provider.util.mjs +1 -1
- package/esm2020/public-api.mjs +12 -2
- package/fesm2015/mediusinc-mng-commons.mjs +553 -146
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +541 -132
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/action/action.component.d.ts +8 -2
- package/lib/components/form/autocomplete/autocomplete.component.d.ts +1 -1
- package/lib/components/layout/menu-item.component.d.ts +11 -4
- package/lib/components/tableview/route/tableview-route.component.d.ts +2 -0
- package/lib/descriptors/action.descriptor.d.ts +7 -0
- package/lib/models/menu.model.d.ts +2 -0
- package/lib/router/index.d.ts +1 -0
- package/lib/router/models/router.model.d.ts +5 -0
- package/lib/router/route-builder.d.ts +28 -16
- package/lib/router/tableview-route-builder.d.ts +34 -0
- package/lib/security/authorization.guard.d.ts +11 -0
- package/lib/security/authorization.service.d.ts +19 -0
- package/lib/security/authorization.util.d.ts +5 -0
- package/lib/security/index.d.ts +3 -0
- package/lib/security/model/authorization.type.d.ts +6 -0
- package/lib/security/model/index.d.ts +3 -0
- package/lib/security/model/permission-service.interface.d.ts +6 -0
- package/lib/security/model/permissions.model.d.ts +44 -0
- package/lib/services/commons.service.d.ts +5 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/version-info.json +5 -5
|
@@ -8,6 +8,7 @@ import { IDataProvider } from '../../data-providers';
|
|
|
8
8
|
import { ActionDescriptor, ActionLinkDescriptor } from '../../descriptors';
|
|
9
9
|
import { ActionLevelEnum } from '../../descriptors/types';
|
|
10
10
|
import { IViewContainer } from '../../models';
|
|
11
|
+
import { MngAuthorizationService } from '../../security';
|
|
11
12
|
import { MngActionExecutorService, MngViewContainerComponentService } from '../../services';
|
|
12
13
|
import { IdType } from '../../types';
|
|
13
14
|
import { ActionData, ActionInstance, IActionConfirmationService } from './models';
|
|
@@ -15,6 +16,7 @@ import * as i0 from "@angular/core";
|
|
|
15
16
|
export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDestroy, IActionConfirmationService {
|
|
16
17
|
private route;
|
|
17
18
|
private translate;
|
|
19
|
+
private authorization;
|
|
18
20
|
private actionExecutor;
|
|
19
21
|
private confirmationService;
|
|
20
22
|
private viewContainerService;
|
|
@@ -43,6 +45,9 @@ export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDe
|
|
|
43
45
|
private isVisibleSubject;
|
|
44
46
|
private isVisibleSubscription?;
|
|
45
47
|
$isVisible: Observable<boolean>;
|
|
48
|
+
private isPermittedSubject;
|
|
49
|
+
private isPermittedSubscription?;
|
|
50
|
+
$isPermitted: Observable<boolean>;
|
|
46
51
|
private isEnabledSubject;
|
|
47
52
|
private isEnabledSubscription?;
|
|
48
53
|
$isEnabled: Observable<boolean>;
|
|
@@ -56,7 +61,8 @@ export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDe
|
|
|
56
61
|
actionLink?: ActionLinkDescriptor<T>;
|
|
57
62
|
hasNoTitle: boolean;
|
|
58
63
|
private subscriptions;
|
|
59
|
-
|
|
64
|
+
private routePermissions?;
|
|
65
|
+
constructor(route: ActivatedRoute, translate: TranslateService, authorization: MngAuthorizationService, actionExecutor: MngActionExecutorService, confirmationService: ConfirmationService, viewContainerService: MngViewContainerComponentService<T, S> | null);
|
|
60
66
|
ngOnInit(): void;
|
|
61
67
|
ngOnChanges(changes: SimpleChanges): void;
|
|
62
68
|
ngOnDestroy(): void;
|
|
@@ -64,6 +70,6 @@ export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDe
|
|
|
64
70
|
getConfirmationService(): ConfirmationService;
|
|
65
71
|
getConfirmationServiceInstanceKey(action: ActionDescriptor<any>): string;
|
|
66
72
|
private processSubscriptions;
|
|
67
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MngActionComponent<any, any>, [null, null, null, null, { optional: true; }]>;
|
|
73
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MngActionComponent<any, any>, [null, null, null, null, null, { optional: true; }]>;
|
|
68
74
|
static ɵcmp: i0.ɵɵComponentDeclaration<MngActionComponent<any, any>, "mng-action", never, { "action": "action"; "item": "item"; "itemId": "itemId"; "actionData": "actionData"; "queryParam": "queryParam"; "dataProvider": "dataProvider"; "inputDisabled": "disabled"; "inputLoading": "loading"; "viewContainerInit": "viewContainer"; }, { "finishEventEmitter": "finish"; }, never, never>;
|
|
69
75
|
}
|
|
@@ -40,7 +40,7 @@ export declare class MngAutocompleteComponent implements OnInit, OnDestroy, Cont
|
|
|
40
40
|
onSearch(event: any): void;
|
|
41
41
|
onSelect(value: any): void;
|
|
42
42
|
onFocus(event: Event): void;
|
|
43
|
-
onBlur(
|
|
43
|
+
onBlur(event: any): void;
|
|
44
44
|
registerOnChange(fn: any): void;
|
|
45
45
|
registerOnTouched(fn: any): void;
|
|
46
46
|
setDisabledState(isDisabled: boolean): void;
|
|
@@ -2,6 +2,7 @@ import { Injector, OnDestroy, OnInit } from '@angular/core';
|
|
|
2
2
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { MngMenuItem } from '../../models';
|
|
5
|
+
import { MngAuthorizationService } from '../../security';
|
|
5
6
|
import { MngCommonsService } from '../../services';
|
|
6
7
|
import { MngMainLayoutComponentService } from './services';
|
|
7
8
|
import * as i0 from "@angular/core";
|
|
@@ -9,23 +10,29 @@ export declare class MngMenuItemComponent implements OnInit, OnDestroy {
|
|
|
9
10
|
private injector;
|
|
10
11
|
private router;
|
|
11
12
|
private route;
|
|
13
|
+
private authorization;
|
|
12
14
|
mngCommons: MngCommonsService;
|
|
13
15
|
mainLayoutService: MngMainLayoutComponentService;
|
|
14
16
|
item: MngMenuItem;
|
|
15
17
|
index: number;
|
|
16
18
|
root: boolean;
|
|
17
19
|
parentKey: string | null;
|
|
20
|
+
private hostClassNoPadding;
|
|
18
21
|
key: string;
|
|
19
22
|
active: boolean;
|
|
20
23
|
hover: boolean;
|
|
21
|
-
private
|
|
22
|
-
|
|
24
|
+
private guardsIsAllowedSubject;
|
|
25
|
+
guardsIsAllowed$: Observable<boolean>;
|
|
26
|
+
private isPermittedSubject;
|
|
27
|
+
isPermitted$: Observable<boolean>;
|
|
23
28
|
private itemUrl?;
|
|
24
29
|
private menuSourceSubscription?;
|
|
25
30
|
private menuResetSubscription?;
|
|
26
31
|
private routerEventsSubscription?;
|
|
27
|
-
private
|
|
28
|
-
|
|
32
|
+
private guardsIsAllowedSubscription?;
|
|
33
|
+
private isPermittedSubscription?;
|
|
34
|
+
private isVisibleCombinedSubscription?;
|
|
35
|
+
constructor(injector: Injector, router: Router, route: ActivatedRoute, authorization: MngAuthorizationService, mngCommons: MngCommonsService, mainLayoutService: MngMainLayoutComponentService);
|
|
29
36
|
ngOnInit(): void;
|
|
30
37
|
updateActiveStateFromRoute(): void;
|
|
31
38
|
itemClick(event: Event): void;
|
|
@@ -2,6 +2,7 @@ import { OnInit } from '@angular/core';
|
|
|
2
2
|
import { ActivatedRoute } from '@angular/router';
|
|
3
3
|
import { ITableviewDataProvider } from '../../../data-providers';
|
|
4
4
|
import { ActionDescriptor, TableviewDescriptor } from '../../../descriptors';
|
|
5
|
+
import { MngRouterData } from '../../../router/models';
|
|
5
6
|
import { MngTableviewComponent } from '../tableview.component';
|
|
6
7
|
import { AMngTableviewRouteComponent } from './tableview-route.abstract.component';
|
|
7
8
|
import * as i0 from "@angular/core";
|
|
@@ -12,6 +13,7 @@ export declare class MngTableviewRouteComponent<T, S> extends AMngTableviewRoute
|
|
|
12
13
|
actionsInit?: Array<ActionDescriptor<T>>;
|
|
13
14
|
tableviewComponent?: MngTableviewComponent<T, S>;
|
|
14
15
|
constructor(route: ActivatedRoute);
|
|
16
|
+
get routeData(): MngRouterData;
|
|
15
17
|
protected createTableviewDescriptor(): TableviewDescriptor<T>;
|
|
16
18
|
protected createTableviewDataProvider(): ITableviewDataProvider<T, S>;
|
|
17
19
|
protected createActionDescriptors(): Array<ActionDescriptor<T>>;
|
|
@@ -4,6 +4,7 @@ import { Confirmation } from 'primeng/api';
|
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import { ActionContext, ActionContextValidation } from '../components/action/models';
|
|
6
6
|
import { IDataProvider, IEditorDataProvider } from '../data-providers';
|
|
7
|
+
import { APermissions } from '../security/model';
|
|
7
8
|
import { ClassType, IdType } from '../types';
|
|
8
9
|
import { EditorDescriptor, ModelDescriptor } from './';
|
|
9
10
|
import { ActionActivationTriggerEnum, ActionEditorDialogSizeEnum, ActionEditorSubmitTypeEnum, ActionLevelEnum, ActionPositionEnum, ActionSizeEnum, ActionTypeEnum } from './types';
|
|
@@ -47,6 +48,8 @@ export declare class ActionDescriptor<T> {
|
|
|
47
48
|
protected _runNotificationErrorMessage?: string;
|
|
48
49
|
protected _afterRunAction?: ActionDescriptor<unknown>;
|
|
49
50
|
protected _onRunErrorAction?: ActionDescriptor<unknown>;
|
|
51
|
+
protected _permissions?: APermissions;
|
|
52
|
+
protected _permissionsRouteType?: string;
|
|
50
53
|
constructor(model: ModelDescriptor<T> | null, actionName: string, parentType?: ClassType<any>, parentProperty?: string);
|
|
51
54
|
get model(): ModelDescriptor<T> | null;
|
|
52
55
|
get parentTypeName(): string | undefined;
|
|
@@ -91,6 +94,8 @@ export declare class ActionDescriptor<T> {
|
|
|
91
94
|
get runNotificationErrorMessage(): string | undefined;
|
|
92
95
|
get afterRunAction(): ActionDescriptor<unknown> | undefined;
|
|
93
96
|
get onRunErrorAction(): ActionDescriptor<unknown> | undefined;
|
|
97
|
+
get permissions(): APermissions | undefined;
|
|
98
|
+
get permissionsRouteType(): string | undefined;
|
|
94
99
|
withDataProvider(dataProvider: IDataProvider<T, any>): this;
|
|
95
100
|
withServiceType<S>(serviceType: Type<S>): this;
|
|
96
101
|
withRunFunction<S>(fn: (ctx: ActionContext<T, S>) => Observable<T | undefined | null>): this;
|
|
@@ -128,6 +133,8 @@ export declare class ActionDescriptor<T> {
|
|
|
128
133
|
withRunNotificationError(title?: string, message?: string, hasNotification?: boolean): this;
|
|
129
134
|
withAfterRunAction<RT>(action: ActionDescriptor<RT>): this;
|
|
130
135
|
withOnRunErrorAction<RT>(action: ActionDescriptor<RT>): this;
|
|
136
|
+
withPermissions(permissions: APermissions): this;
|
|
137
|
+
withPermissionsRouteType(permissionsRouteType: string): this;
|
|
131
138
|
}
|
|
132
139
|
export declare class ActionSimpleDescriptor<T> extends ActionDescriptor<T> {
|
|
133
140
|
constructor(actionName: string, modelType?: ClassType<T>, idProperty?: string, titleProperty?: string);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { QueryParamsHandling } from '@angular/router';
|
|
2
|
+
import { APermissions } from '../security/model';
|
|
2
3
|
export interface MngMenuItem {
|
|
3
4
|
title?: string;
|
|
4
5
|
label?: string;
|
|
5
6
|
icon?: string;
|
|
6
7
|
items?: Array<MngMenuItem>;
|
|
7
8
|
guards?: Array<any>;
|
|
9
|
+
permissions?: APermissions;
|
|
8
10
|
separator?: boolean;
|
|
9
11
|
className?: string;
|
|
10
12
|
badge?: string;
|
package/lib/router/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ActivatedRouteSnapshot, Data } from '@angular/router';
|
|
|
3
3
|
import { MenuItem } from 'primeng/api';
|
|
4
4
|
import { ITableviewDataProvider } from '../../data-providers';
|
|
5
5
|
import { ActionDescriptor, TableviewDescriptor } from '../../descriptors';
|
|
6
|
+
import { APermissions } from '../../security/model';
|
|
6
7
|
export declare type BreadcrumbType = string | string[] | MngBreadcrumbMenuItem | MngBreadcrumbMenuItem[] | ((routeUrl: string, route: ActivatedRouteSnapshot) => MngBreadcrumbMenuItem[]);
|
|
7
8
|
export interface MngBreadcrumbMenuItem extends MenuItem {
|
|
8
9
|
isHome?: boolean;
|
|
@@ -15,8 +16,12 @@ export interface MngRouterData extends Data {
|
|
|
15
16
|
dataProvider: ITableviewDataProvider<any, any>;
|
|
16
17
|
actions?: Array<ActionDescriptor<any>>;
|
|
17
18
|
};
|
|
19
|
+
tableviewPermissions?: {
|
|
20
|
+
[key: string]: APermissions;
|
|
21
|
+
};
|
|
18
22
|
topbarComponent?: Type<any>;
|
|
19
23
|
breadcrumbComponent?: Type<any>;
|
|
20
24
|
menuComponent?: Type<any>;
|
|
21
25
|
footerComponent?: Type<any>;
|
|
26
|
+
permissions?: APermissions;
|
|
22
27
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { LoadChildren, Route, Routes } from '@angular/router';
|
|
3
3
|
import { MngMainLayoutComponent } from '../components/layout';
|
|
4
|
+
import { AMngTableviewRouteComponent } from '../components/tableview';
|
|
4
5
|
import { ITableviewDataProvider } from '../data-providers';
|
|
5
6
|
import { ActionDescriptor, TableviewDescriptor } from '../descriptors';
|
|
6
7
|
import { MngMenuItem } from '../models';
|
|
8
|
+
import { APermissions } from '../security/model';
|
|
7
9
|
import { BreadcrumbType, MngRouterData } from './models';
|
|
10
|
+
import { TableviewRouteBuilder } from './tableview-route-builder';
|
|
8
11
|
export declare class RoutesBuilder {
|
|
9
12
|
private readonly layoutRoute?;
|
|
10
13
|
private routes;
|
|
@@ -16,7 +19,14 @@ export declare class RoutesBuilder {
|
|
|
16
19
|
addRouteRedirect(path: string, redirectTo: string, pathMatch?: 'full' | 'prefix'): this;
|
|
17
20
|
addLazyRoute(path: string, loadChildren: LoadChildren, canLoad?: Array<any>): this;
|
|
18
21
|
addRoute(path: string, component: Type<any>): this;
|
|
22
|
+
addTableview<C extends AMngTableviewRouteComponent<any, any>>(builder: TableviewRouteBuilder<C>): this;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use TableviewRouteBuilder with addTableview
|
|
25
|
+
*/
|
|
19
26
|
addTableviewRoutes<T, S>(path: string, descriptor: TableviewDescriptor<T>, tableviewDataProvider: ITableviewDataProvider<T, S>, actions?: Array<ActionDescriptor<T>>, hasDetails?: boolean, hasEdit?: boolean, hasAdd?: boolean): this;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use TableviewRouteBuilder with addTableview
|
|
29
|
+
*/
|
|
20
30
|
addTableviewRoutesFromComponent(path: string, component: Type<any>, hasDetails?: boolean, hasEdit?: boolean, hasAdd?: boolean): this;
|
|
21
31
|
addRouteBuilder(routeBuilder: RouteBuilder): this;
|
|
22
32
|
toRoute(): RouteBuilder;
|
|
@@ -26,6 +36,7 @@ export declare class RoutesBuilder {
|
|
|
26
36
|
export declare class RouteBuilder {
|
|
27
37
|
private readonly route;
|
|
28
38
|
private routePath;
|
|
39
|
+
private routeData;
|
|
29
40
|
private root?;
|
|
30
41
|
private parent?;
|
|
31
42
|
private children;
|
|
@@ -33,13 +44,21 @@ export declare class RouteBuilder {
|
|
|
33
44
|
private menuItemChildren;
|
|
34
45
|
private breadcrumb?;
|
|
35
46
|
private pageTitle?;
|
|
47
|
+
private permissions?;
|
|
36
48
|
private constructor();
|
|
37
49
|
static create(path: string, component: Type<any>): RouteBuilder;
|
|
38
50
|
static createRedirect(path: string, redirectTo: string, pathMatch?: 'full' | 'prefix'): RouteBuilder;
|
|
39
51
|
static createLazyRoute(path: string, loadChildren: LoadChildren, canLoad?: Array<any>): RouteBuilder;
|
|
40
52
|
static createFromRoute(route: Route): RouteBuilder;
|
|
41
53
|
static createLayoutRoute(path: string, layoutComponent?: typeof MngMainLayoutComponent, topbarComponent?: Type<any>, breadcrumbComponent?: Type<any>, menuComponent?: Type<any>, footerComponent?: Type<any>): RouteBuilder;
|
|
54
|
+
static createTableview<C extends AMngTableviewRouteComponent<any, any>>(builder: TableviewRouteBuilder<C>): RouteBuilder;
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Use TableviewRouteBuilder
|
|
57
|
+
*/
|
|
42
58
|
static createTableviewRoutes<T, S>(path: string, descriptor: TableviewDescriptor<T>, dataProvider: ITableviewDataProvider<T, S>, actions?: Array<ActionDescriptor<T>>, hasDetails?: boolean, hasEdit?: boolean, hasAdd?: boolean): RouteBuilder;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated Use TableviewRouteBuilder
|
|
61
|
+
*/
|
|
43
62
|
static createTableviewRoutesFromComponent(path: string, component: Type<any>, hasDetails?: boolean, hasEdit?: boolean, hasAdd?: boolean): RouteBuilder;
|
|
44
63
|
private static addActionsSubroutesToTableviewParent;
|
|
45
64
|
withRoot(routesBuilder: RoutesBuilder): this;
|
|
@@ -52,15 +71,21 @@ export declare class RouteBuilder {
|
|
|
52
71
|
withCanActivate(diToken: any): this;
|
|
53
72
|
withCanDeactivate(diToken: any): this;
|
|
54
73
|
withResolver(diToken: any, name: string): this;
|
|
55
|
-
withData(data:
|
|
56
|
-
withDataBuilder(dataBuilder: RouteDataBuilder): this;
|
|
74
|
+
withData(data: MngRouterData): this;
|
|
57
75
|
withMngMenuItem(menuItem: MngMenuItem): this;
|
|
58
76
|
withMenuItem(icon?: string, label?: string, routerLink?: Array<string>): this;
|
|
59
77
|
withMenuItemChild(label: string, icon?: string, routerLink?: Array<string>): this;
|
|
60
78
|
withMenuItemChildren(routesBuilder: RoutesBuilder): this;
|
|
79
|
+
withPermissions(permissions: APermissions): this;
|
|
61
80
|
addChild(path: string, component: Type<any>): RouteBuilder;
|
|
62
81
|
addChildBuilder(routeBuilder: RouteBuilder): this;
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated
|
|
84
|
+
*/
|
|
63
85
|
addTableviewRoutes<T, S>(path: string, descriptor: TableviewDescriptor<T>, tableviewDataProvider: ITableviewDataProvider<T, S>, actions?: Array<ActionDescriptor<T>>, hasDetails?: boolean, hasEdit?: boolean, hasAdd?: boolean): RouteBuilder;
|
|
86
|
+
/**
|
|
87
|
+
* @deprecated
|
|
88
|
+
*/
|
|
64
89
|
addTableviewRoutesFromComponent(path: string, component: Type<any>, hasDetails?: boolean, hasEdit?: boolean, hasAdd?: boolean): RouteBuilder;
|
|
65
90
|
toParent(): RouteBuilder;
|
|
66
91
|
toRoot(): RoutesBuilder;
|
|
@@ -71,16 +96,3 @@ export declare class RouteBuilder {
|
|
|
71
96
|
private adjustMenuRouterLinksFromBuilder;
|
|
72
97
|
private findMenuItemGuards;
|
|
73
98
|
}
|
|
74
|
-
export declare class RouteDataBuilder {
|
|
75
|
-
private data;
|
|
76
|
-
constructor(init?: Data);
|
|
77
|
-
static create(data?: Data): RouteDataBuilder;
|
|
78
|
-
withBreadcrumb(breadcrumb: BreadcrumbType): this;
|
|
79
|
-
withPageTitle(pageTitle: string): this;
|
|
80
|
-
withTableview(descriptor: TableviewDescriptor<any>, dataProvider: ITableviewDataProvider<any, any>, actions?: Array<ActionDescriptor<any>>): this;
|
|
81
|
-
withTopbarComponent(component: Type<any>): this;
|
|
82
|
-
withBreadcrumbComponent(component: Type<any>): this;
|
|
83
|
-
withMenuComponent(component: Type<any>): this;
|
|
84
|
-
withFooterComponent(component: Type<any>): this;
|
|
85
|
-
build(): MngRouterData;
|
|
86
|
-
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Type } from '@angular/core';
|
|
2
|
+
import { Route } from '@angular/router';
|
|
3
|
+
import { AMngTableviewRouteComponent } from '../components/tableview';
|
|
4
|
+
import { ITableviewDataProvider } from '../data-providers';
|
|
5
|
+
import { ActionDescriptor, TableviewDescriptor } from '../descriptors';
|
|
6
|
+
import { APermissions } from '../security/model';
|
|
7
|
+
import { RouteBuilder } from './route-builder';
|
|
8
|
+
export declare class TableviewRouteBuilder<C extends AMngTableviewRouteComponent<any, any>> {
|
|
9
|
+
private path;
|
|
10
|
+
private descriptor?;
|
|
11
|
+
private dataProvider?;
|
|
12
|
+
private actions?;
|
|
13
|
+
private component?;
|
|
14
|
+
private hasDetails;
|
|
15
|
+
private detailsPath;
|
|
16
|
+
private hasEdit;
|
|
17
|
+
private editPath;
|
|
18
|
+
private hasAdd;
|
|
19
|
+
private addPath;
|
|
20
|
+
private permissions?;
|
|
21
|
+
private constructor();
|
|
22
|
+
static fromComponent<C extends AMngTableviewRouteComponent<any, any>>(path: string, component: Type<C>): TableviewRouteBuilder<C>;
|
|
23
|
+
static from(path: string, descriptor: TableviewDescriptor<any>, dataProvider: ITableviewDataProvider<any, any>, actions: Array<ActionDescriptor<any>>): TableviewRouteBuilder<never>;
|
|
24
|
+
withDetails(hasDetails?: boolean, permissions?: APermissions, path?: string): this;
|
|
25
|
+
withAdd(hasAdd?: boolean, permissions?: APermissions, path?: string): this;
|
|
26
|
+
withEdit(hasEdit?: boolean, permissions?: APermissions, path?: string): this;
|
|
27
|
+
withPermissions(read?: APermissions, add?: APermissions, edit?: APermissions, delet?: APermissions, details?: APermissions): this;
|
|
28
|
+
withPermissionsOther(key: string, permissions: APermissions): this;
|
|
29
|
+
withPermissionsObject(permissions: {
|
|
30
|
+
[key: string]: APermissions;
|
|
31
|
+
}): this;
|
|
32
|
+
build(): Route;
|
|
33
|
+
toRouteBuilder(): RouteBuilder;
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { MngAuthorizationService } from './authorization.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class MngAuthorizationGuard implements CanActivate {
|
|
6
|
+
private authorization;
|
|
7
|
+
constructor(authorization: MngAuthorizationService);
|
|
8
|
+
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MngAuthorizationGuard, never>;
|
|
10
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MngAuthorizationGuard>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { ActivatedRouteSnapshot, Router } from '@angular/router';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { ActionContextValidation } from '../components/action/models';
|
|
5
|
+
import { APermissions } from '../security/model';
|
|
6
|
+
import { MngCommonsService } from '../services';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class MngAuthorizationService {
|
|
9
|
+
private injector;
|
|
10
|
+
private router;
|
|
11
|
+
private commons;
|
|
12
|
+
constructor(injector: Injector, router: Router, commons: MngCommonsService);
|
|
13
|
+
isPermitted(permissions: APermissions, route?: ActivatedRouteSnapshot, actionCtx?: ActionContextValidation<unknown, unknown>): Observable<boolean>;
|
|
14
|
+
private isPermittedAll;
|
|
15
|
+
private isPermittedAny;
|
|
16
|
+
private isPermittedService;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MngAuthorizationService, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MngAuthorizationService>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { APermissions, Permissions } from './model';
|
|
2
|
+
export declare class AuthorizationUtil {
|
|
3
|
+
static isPermitted(permissions: APermissions, userRoles: Array<string>): boolean;
|
|
4
|
+
static isRbacPermitted(permissions: Permissions.Roles, userRoles: Array<string>): boolean;
|
|
5
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ActionContextValidation } from '../../components/action/models';
|
|
4
|
+
export interface IPermissionService {
|
|
5
|
+
isPermitted(route?: ActivatedRouteSnapshot, routerState?: RouterStateSnapshot, actionCtx?: ActionContextValidation<unknown, unknown>): Observable<boolean>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Type } from '@angular/core';
|
|
2
|
+
import { AuthorizationTypeEnum } from './authorization.type';
|
|
3
|
+
import { IPermissionService } from './permission-service.interface';
|
|
4
|
+
export declare abstract class APermissions {
|
|
5
|
+
private readonly _authorizationType;
|
|
6
|
+
constructor(type: AuthorizationTypeEnum);
|
|
7
|
+
get authorizationType(): AuthorizationTypeEnum;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace Permissions {
|
|
10
|
+
class All extends APermissions {
|
|
11
|
+
private _permissions;
|
|
12
|
+
private constructor();
|
|
13
|
+
static of(...permissions: Array<APermissions>): All;
|
|
14
|
+
get permissions(): APermissions[];
|
|
15
|
+
and(...permissions: Array<APermissions>): this;
|
|
16
|
+
}
|
|
17
|
+
class Any extends APermissions {
|
|
18
|
+
private _permissions;
|
|
19
|
+
private constructor();
|
|
20
|
+
static of(...permissions: Array<APermissions>): Any;
|
|
21
|
+
get permissions(): APermissions[];
|
|
22
|
+
or(...permissions: Array<APermissions>): this;
|
|
23
|
+
}
|
|
24
|
+
class Roles extends APermissions {
|
|
25
|
+
private _roles;
|
|
26
|
+
private constructor();
|
|
27
|
+
static of(...roles: Array<string>): Roles;
|
|
28
|
+
get roles(): string[][];
|
|
29
|
+
and(...roles: Array<string>): this;
|
|
30
|
+
or(...roles: Array<string>): this;
|
|
31
|
+
}
|
|
32
|
+
class Service extends APermissions {
|
|
33
|
+
readonly service: Type<IPermissionService>;
|
|
34
|
+
private constructor();
|
|
35
|
+
static of(service: Type<IPermissionService>): Service;
|
|
36
|
+
}
|
|
37
|
+
class ActionTypes {
|
|
38
|
+
static readonly READ = "read";
|
|
39
|
+
static readonly ADD = "add";
|
|
40
|
+
static readonly EDIT = "edit";
|
|
41
|
+
static readonly DELETE = "delete";
|
|
42
|
+
static readonly DETAILS = "details";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -28,6 +28,8 @@ export declare class MngCommonsService {
|
|
|
28
28
|
private _colorScheme;
|
|
29
29
|
private _user?;
|
|
30
30
|
private userSubject;
|
|
31
|
+
private _userRoles;
|
|
32
|
+
private userRolesSubject;
|
|
31
33
|
constructor(router: Router, primengConfig: PrimeNGConfig, translate: TranslateService, titleService: Title, moduleConfig: MngModuleConfig, localStorage: Storage);
|
|
32
34
|
get appName(): string;
|
|
33
35
|
get appOwner(): string;
|
|
@@ -59,6 +61,9 @@ export declare class MngCommonsService {
|
|
|
59
61
|
get user(): IUser | undefined;
|
|
60
62
|
set user(user: IUser | undefined);
|
|
61
63
|
get user$(): Observable<IUser | undefined>;
|
|
64
|
+
get userRoles(): Array<string>;
|
|
65
|
+
set userRoles(roles: Array<string>);
|
|
66
|
+
get userRoles$(): Observable<string[]>;
|
|
62
67
|
reset(): void;
|
|
63
68
|
menuChangeActiveKey(key: string): void;
|
|
64
69
|
menuReset(): void;
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
package/version-info.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediusinc/mng-commons",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"tag": "v0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"tag": "v0.10.0",
|
|
5
5
|
"distance": 0,
|
|
6
|
-
"hash": "
|
|
6
|
+
"hash": "85fdc0ad",
|
|
7
7
|
"dirty": false,
|
|
8
|
-
"semver": "0.
|
|
9
|
-
"raw": "v0.
|
|
8
|
+
"semver": "0.10.0",
|
|
9
|
+
"raw": "v0.10.0-85fdc0ad"
|
|
10
10
|
}
|