From f00532f95d1504e4156b56ebf8bb95a4189b19e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Tue, 29 Nov 2022 16:00:16 -0500 Subject: [PATCH] feat(layer & catalog): provide interface to handle profils on layer (auth) (#1109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Pierre-Étienne Lord --- .../src/lib/context-manager/shared/context.service.ts | 7 ++++--- .../catalog/catalog-browser/catalog-browser.component.ts | 3 +++ packages/geo/src/lib/catalog/shared/catalog.abstract.ts | 1 + .../geo/src/lib/layer/shared/layers/layer.interface.ts | 5 +++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/context/src/lib/context-manager/shared/context.service.ts b/packages/context/src/lib/context-manager/shared/context.service.ts index 7ce5171454..a5f20cf07b 100644 --- a/packages/context/src/lib/context-manager/shared/context.service.ts +++ b/packages/context/src/lib/context-manager/shared/context.service.ts @@ -29,7 +29,7 @@ import { } from '@igo2/core'; import { AuthService } from '@igo2/auth'; -import type { IgoMap, Layer } from '@igo2/geo'; +import type { IgoMap, Layer, LayerOptions } from '@igo2/geo'; import { TypePermission } from './context.enum'; import { @@ -476,8 +476,9 @@ export class ContextService { layerOptions: { title: layer.options.title, zIndex: ++i, - visible: layer.visible - }, + visible: layer.visible, + security: layer.security + } as LayerOptions, sourceOptions: { type: layer.dataSource.options.type, params: layer.dataSource.options.params, diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.ts b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.ts index 5986d75335..0b1093fb5c 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.ts +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser.component.ts @@ -159,6 +159,9 @@ export class CatalogBrowserComponent implements OnInit, OnDestroy { if (!layer.options.sourceOptions.optionsFromApi) { layer.options.sourceOptions.optionsFromApi = true; } + if (this.catalog.profils?.length) { + layer.options.security = { profils: this.catalog.profils }; + } return this.layerService.createAsyncLayer(layer.options); }); diff --git a/packages/geo/src/lib/catalog/shared/catalog.abstract.ts b/packages/geo/src/lib/catalog/shared/catalog.abstract.ts index add72c5ca2..f27d12fda5 100644 --- a/packages/geo/src/lib/catalog/shared/catalog.abstract.ts +++ b/packages/geo/src/lib/catalog/shared/catalog.abstract.ts @@ -36,6 +36,7 @@ export abstract class Catalog implements ICatalog { sortDirection?: 'asc' | 'desc'; setCrossOriginAnonymous?: boolean; showLegend?: boolean; + profils?: string[]; // ICatalog ----------------------------- protected catalogService: CatalogService; diff --git a/packages/geo/src/lib/layer/shared/layers/layer.interface.ts b/packages/geo/src/lib/layer/shared/layers/layer.interface.ts index 8c14d354b1..5a8f6a9d31 100644 --- a/packages/geo/src/lib/layer/shared/layers/layer.interface.ts +++ b/packages/geo/src/lib/layer/shared/layers/layer.interface.ts @@ -13,6 +13,7 @@ export interface LayerOptions { title?: string; id?: string; alias?: string; + security?: LayerSecurityOptions; baseLayer?: boolean; opacity?: number; visible?: boolean; @@ -36,6 +37,10 @@ export interface LayerOptions { showButtonZoomToExtent?: boolean; } +export interface LayerSecurityOptions { + profils?: string[] +} + export interface GeoWorkspaceOptions { srcId?: string; workspaceId?: string;