@platform-mesh/portal-ui-lib 0.52.0 → 0.52.1

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.
@@ -1,5 +1,5 @@
1
1
  import { NodeContext, LuigiNode, EntityDefinition, CustomGlobalNodesService, HeaderBarConfigService, HeaderBarConfig, LuigiExtendedGlobalContextConfigService, NavigationRedirectStrategy, NodeChangeHookConfigService, NodeContextProcessingService, RoutingConfigService, UserProfileConfigService, UserProfile, CustomMessageListener } from '@openmfp/portal-ui-lib';
2
- import { ResourceDefinition } from '@platform-mesh/portal-ui-lib/models';
2
+ import { ResourceDefinition, Permission } from '@platform-mesh/portal-ui-lib/models';
3
3
  import * as i0 from '@angular/core';
4
4
 
5
5
  interface PortalContext extends Record<string, any> {
@@ -10,10 +10,6 @@ interface PortalEntityContext {
10
10
  id: string;
11
11
  };
12
12
  }
13
- interface Permission {
14
- actions: string[];
15
- resource: string;
16
- }
17
13
  interface PortalNodeContext extends NodeContext {
18
14
  portalContext: PortalContext;
19
15
  organizationId?: string;
@@ -85,11 +81,14 @@ declare class NodeChangeHookConfigServiceImpl implements NodeChangeHookConfigSer
85
81
  declare class NodeContextProcessingServiceImpl implements NodeContextProcessingService {
86
82
  private crdGatewayKcpPatchResolver;
87
83
  private accountInfoService;
84
+ private instancePermissionsService;
88
85
  private organizationReadyService;
89
86
  private errorHandlerService;
87
+ private luigiCoreService;
90
88
  processNodeContext(dynamicEntityId: string, entityNode: PortalLuigiNode, ctx: PortalNodeContext): Promise<void>;
91
89
  private addFieldsToContext;
92
90
  private addFieldsToContextFromAccountInfo;
91
+ private getEntityPermissions;
93
92
  private accamulatePortalPermissions;
94
93
  static ɵfac: i0.ɵɵFactoryDeclaration<NodeContextProcessingServiceImpl, never>;
95
94
  static ɵprov: i0.ɵɵInjectableDeclaration<NodeContextProcessingServiceImpl>;
@@ -1,21 +1,25 @@
1
1
  import { NodeContext } from '@openmfp/portal-ui-lib';
2
- import { ResourceDefinition, ResourceOperationType, ResourcePagination, Resource, ResourceListResult, ResourceSubscriptionResult, AccountInfo, LogicalCluster } from '@platform-mesh/portal-ui-lib/models';
2
+ import { ResourceDefinition, PermissionsDefinition, ResourceOperationType, ResourcePagination, Resource, ResourceListResult, ResourceSubscriptionResult, AccountInfo, LogicalCluster } from '@platform-mesh/portal-ui-lib/models';
3
3
  import * as apollo_angular from 'apollo-angular';
4
4
  import { Apollo } from 'apollo-angular';
5
5
  import * as i0 from '@angular/core';
6
- import { GenericResource } from '@openmfp/ngx';
7
6
  import { Observable } from 'rxjs';
7
+ import { GenericResource } from '@openmfp/ngx';
8
8
  import { VariableOptions } from 'gql-query-builder';
9
9
 
10
10
  interface ResourceNodeContext extends Partial<NodeContext> {
11
11
  resourceDefinition?: ResourceDefinition;
12
12
  organization?: string;
13
+ accountPath?: string;
13
14
  entityName?: string;
14
15
  resourceId?: string;
15
16
  accountId?: string;
16
17
  kcpCA?: string;
17
18
  namespaceId?: string;
18
19
  namespaces?: string[];
20
+ portalPermissions?: {
21
+ [key: string]: string[];
22
+ };
19
23
  portalContext: {
20
24
  crdGatewayApiUrl: string;
21
25
  openSearchApiUrl?: string;
@@ -65,6 +69,40 @@ declare class GatewayService {
65
69
  static ɵprov: i0.ɵɵInjectableDeclaration<GatewayService>;
66
70
  }
67
71
 
72
+ interface InstanceCheck {
73
+ resource: string;
74
+ group: string;
75
+ namespace?: string;
76
+ name: string;
77
+ actions: string[];
78
+ }
79
+ interface ResourceCheckRequest {
80
+ organization: string;
81
+ accountPath?: string;
82
+ checks: InstanceCheck[];
83
+ }
84
+ interface InstancePermissionResponse {
85
+ resource: string;
86
+ namespace?: string;
87
+ name?: string;
88
+ actions: string[];
89
+ }
90
+ declare class InstancePermissionsService {
91
+ private httpClient;
92
+ private luigiCoreService;
93
+ private requestChecks;
94
+ checkInstance(nodeContext: ResourceNodeContext, permissionsDefinition: PermissionsDefinition, instance: {
95
+ name: string;
96
+ namespace?: string;
97
+ }): Observable<InstancePermissionResponse[]>;
98
+ checkInstances(nodeContext: ResourceNodeContext, permissionsDefinition: PermissionsDefinition, instances: {
99
+ name: string;
100
+ namespace?: string;
101
+ }[]): Observable<InstancePermissionResponse[]>;
102
+ static ɵfac: i0.ɵɵFactoryDeclaration<InstancePermissionsService, never>;
103
+ static ɵprov: i0.ɵɵInjectableDeclaration<InstancePermissionsService>;
104
+ }
105
+
68
106
  interface ReadResourcesParams {
69
107
  /** Free-text query — used by the OpenSearch implementation; ignored by ResourceService. */
70
108
  q?: string;
@@ -187,5 +225,5 @@ declare class OrganizationReadyService {
187
225
  static ɵprov: i0.ɵɵInjectableDeclaration<OrganizationReadyService>;
188
226
  }
189
227
 
190
- export { AccountInfoService, ApolloFactory, ErrorHandlerService, GatewayService, LogicalClusterService, OrganizationReadyService, ResourceService };
191
- export type { ListOptions, ReadResources, ReadResourcesPagination, ReadResourcesParams, ReadResourcesResult, ReadResourcesSubscriptionResult, ResourceNodeContext, ResourceRequestParams };
228
+ export { AccountInfoService, ApolloFactory, ErrorHandlerService, GatewayService, InstancePermissionsService, LogicalClusterService, OrganizationReadyService, ResourceService };
229
+ export type { InstanceCheck, InstancePermissionResponse, ListOptions, ReadResources, ReadResourcesPagination, ReadResourcesParams, ReadResourcesResult, ReadResourcesSubscriptionResult, ResourceCheckRequest, ResourceNodeContext, ResourceRequestParams };
@@ -1,4 +1,4 @@
1
- import { PlatformMeshFieldDefinition, Resource, ResourceSubscriptionResult, PropertyField } from '@platform-mesh/portal-ui-lib/models';
1
+ import { PlatformMeshFieldDefinition, InstancePermission, Resource, ResourceSubscriptionResult, PropertyField } from '@platform-mesh/portal-ui-lib/models';
2
2
  import { NodeContext } from '@openmfp/portal-ui-lib';
3
3
 
4
4
  declare function buildGraphQLInputTypeName(apiGroup: string | undefined, version: string | undefined, entity: string): string;
@@ -13,6 +13,8 @@ declare const generateGraphQLFields: (uiFields: PlatformMeshFieldDefinition[]) =
13
13
 
14
14
  declare const getValueByPath: <T extends object, R = unknown>(obj: T, path: string) => R | undefined;
15
15
 
16
+ declare const permissionKey: (instance: Partial<Omit<InstancePermission, "actions">>) => string;
17
+
16
18
  declare const isLocalSetup: () => boolean;
17
19
 
18
20
  declare function isNamespacedResource(nodeContext: Partial<NodeContext>): boolean;
@@ -25,6 +27,18 @@ declare function mergeListWithSubscriptionResult<T>(items: T[], subscriptionResu
25
27
 
26
28
  declare const parseRawGqlQueryToFields: (s: string) => any[];
27
29
 
30
+ /**
31
+ * Tier-1 resource-level permission check (fail-open).
32
+ *
33
+ * Returns true when the verb is granted for the resource, OR when no
34
+ * permissions were fetched for the resource at all (no entry in
35
+ * portalPermissions → we don't gate). Returns false ONLY when permissions
36
+ * WERE fetched for the resource and the verb is absent.
37
+ */
38
+ declare const resourceActionAllowed: (portalPermissions: {
39
+ [key: string]: string[];
40
+ } | undefined, resource: string | undefined, verb: string) => boolean;
41
+
28
42
  declare const getResourceValueByJsonPath: <T>(resource: T, field: {
29
43
  jsonPathExpression?: string;
30
44
  property?: string | string[];
@@ -37,5 +51,5 @@ declare function stripTypename<T>(value: T): T;
37
51
 
38
52
  declare function setPropertyByPath<T extends Record<string, any>>(object: T, path: string, value: unknown): T;
39
53
 
40
- export { buildGraphQLInputTypeName, buildResourcePath, decodeBase64, encodeBase64, generateGraphQLFields, getResourceValueByJsonPath, getValueByPath, isLocalSetup, isNamespacedResource, mergeListWithSubscriptionResult, parseRawGqlQueryToFields, setPropertyByPath, stripTypename };
54
+ export { buildGraphQLInputTypeName, buildResourcePath, decodeBase64, encodeBase64, generateGraphQLFields, getResourceValueByJsonPath, getValueByPath, isLocalSetup, isNamespacedResource, mergeListWithSubscriptionResult, parseRawGqlQueryToFields, permissionKey, resourceActionAllowed, setPropertyByPath, stripTypename };
41
55
  export type { MergeListWithSubscriptionResultOptions };