Skip to content

Commit

Permalink
feat(layer & catalog): provide interface to handle profils on layer (…
Browse files Browse the repository at this point in the history
…auth) (#1109)

Co-authored-by: Pierre-Étienne Lord <[email protected]>
  • Loading branch information
pelord and Pierre-Étienne Lord authored Nov 29, 2022
1 parent d28e18e commit f00532f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
1 change: 1 addition & 0 deletions packages/geo/src/lib/catalog/shared/catalog.abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export abstract class Catalog implements ICatalog {
sortDirection?: 'asc' | 'desc';
setCrossOriginAnonymous?: boolean;
showLegend?: boolean;
profils?: string[];
// ICatalog -----------------------------

protected catalogService: CatalogService;
Expand Down
5 changes: 5 additions & 0 deletions packages/geo/src/lib/layer/shared/layers/layer.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface LayerOptions {
title?: string;
id?: string;
alias?: string;
security?: LayerSecurityOptions;
baseLayer?: boolean;
opacity?: number;
visible?: boolean;
Expand All @@ -36,6 +37,10 @@ export interface LayerOptions {
showButtonZoomToExtent?: boolean;
}

export interface LayerSecurityOptions {
profils?: string[]
}

export interface GeoWorkspaceOptions {
srcId?: string;
workspaceId?: string;
Expand Down

0 comments on commit f00532f

Please sign in to comment.