diff --git a/libs/angular-accelerator/src/lib/components/data-list-grid/data-list-grid.component.html b/libs/angular-accelerator/src/lib/components/data-list-grid/data-list-grid.component.html index 37e8e9e7..41f4fe6a 100644 --- a/libs/angular-accelerator/src/lib/components/data-list-grid/data-list-grid.component.html +++ b/libs/angular-accelerator/src/lib/components/data-list-grid/data-list-grid.component.html @@ -91,9 +91,7 @@
- {{ resolveFieldData(item, titleLineId) || '' }} + {{ resolveFieldData(item, titleLineId) || '' }}
(1) dataListGridComponentState$ = new ReplaySubject(1) - @Input() deletePermission: string | undefined - @Input() editPermission: string | undefined - @Input() viewPermission: string | undefined + @Input() deletePermission: string | string[] | undefined + @Input() editPermission: string | string[] | undefined + @Input() viewPermission: string | string[] | undefined @Input() deleteActionVisibleField: string | undefined @Input() deleteActionEnabledField: string | undefined @Input() viewActionVisibleField: string | undefined diff --git a/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.ts b/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.ts index ba13dbcd..72670bd7 100644 --- a/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.ts +++ b/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.ts @@ -79,10 +79,10 @@ export class InteractiveDataViewComponent implements OnInit, AfterContentInit { dataViewComponentState$ = new ReplaySubject(1) filterViewComponentState$ = new ReplaySubject(1) - @Input() searchConfigPermission: string | undefined - @Input() deletePermission: string | undefined - @Input() editPermission: string | undefined - @Input() viewPermission: string | undefined + @Input() searchConfigPermission: string | string[] | undefined + @Input() deletePermission: string | string[] | string[] | undefined + @Input() editPermission: string | string[] | undefined + @Input() viewPermission: string | string[] | undefined @Input() deleteActionVisibleField: string | undefined @Input() deleteActionEnabledField: string | undefined @Input() viewActionVisibleField: string | undefined diff --git a/libs/angular-accelerator/src/lib/components/page-header/page-header.component.spec.ts b/libs/angular-accelerator/src/lib/components/page-header/page-header.component.spec.ts index 3073fff3..af98024b 100644 --- a/libs/angular-accelerator/src/lib/components/page-header/page-header.component.spec.ts +++ b/libs/angular-accelerator/src/lib/components/page-header/page-header.component.spec.ts @@ -51,7 +51,7 @@ describe('PageHeaderComponent', () => { let component: PageHeaderComponent let fixture: ComponentFixture let pageHeaderHarness: PageHeaderHarness - let userServiceSpy: jest.SpyInstance + let userServiceSpy: jest.SpyInstance beforeEach(async () => { await TestBed.configureTestingModule({ diff --git a/libs/angular-accelerator/src/lib/components/search-header/search-header.component.html b/libs/angular-accelerator/src/lib/components/search-header/search-header.component.html index 01901255..66f42023 100644 --- a/libs/angular-accelerator/src/lib/components/search-header/search-header.component.html +++ b/libs/angular-accelerator/src/lib/components/search-header/search-header.component.html @@ -33,7 +33,7 @@
-
+
| undefined = of({}) searchConfigChangedSlotEmitter: EventEmitter = new EventEmitter() - constructor() { + constructor(configurationService: ConfigurationService) { this.searchConfigChangedSlotEmitter.subscribe((config) => { this.componentStateChanged.emit({ selectedSearchConfig: config?.name ?? null, }) this.selectedSearchConfigChanged.emit(config) }) + this.searchButtonsReversed = + configurationService.getProperty(CONFIG_KEY.ONECX_PORTAL_SEARCH_BUTTONS_REVERSED) === 'true' } ngAfterContentInit(): void { diff --git a/libs/angular-accelerator/src/lib/components/search-header/search-header.stories.ts b/libs/angular-accelerator/src/lib/components/search-header/search-header.stories.ts index 35e81df6..1c80cdca 100644 --- a/libs/angular-accelerator/src/lib/components/search-header/search-header.stories.ts +++ b/libs/angular-accelerator/src/lib/components/search-header/search-header.stories.ts @@ -15,6 +15,8 @@ import { StorybookTranslateModule } from '../../storybook-translate.module' import { PageHeaderComponent } from '../page-header/page-header.component' import { StorybookBreadcrumbModule } from './../../storybook-breadcrumb.module' import { SearchHeaderComponent } from './search-header.component' +import { ConfigurationService } from '@onecx/angular-integration-interface' +import { provideHttpClient } from '@angular/common/http' export default { title: 'SearchHeaderComponent', @@ -25,6 +27,8 @@ export default { importProvidersFrom(BrowserModule), importProvidersFrom(BrowserAnimationsModule), importProvidersFrom(RouterModule.forRoot([], { useHash: true })), + importProvidersFrom(ConfigurationService), + provideHttpClient(), ], }), moduleMetadata({ diff --git a/libs/angular-accelerator/src/lib/model/data-action.ts b/libs/angular-accelerator/src/lib/model/data-action.ts index aa969571..86de3649 100644 --- a/libs/angular-accelerator/src/lib/model/data-action.ts +++ b/libs/angular-accelerator/src/lib/model/data-action.ts @@ -2,7 +2,7 @@ export interface DataAction { id?: string labelKey?: string icon?: string - permission: string + permission: string | string[] classes?: string[] disabled?: boolean actionVisibleField?: string diff --git a/libs/angular-integration-interface/mocks/mock-user-service.ts b/libs/angular-integration-interface/mocks/mock-user-service.ts index 95534ca8..f09e835a 100644 --- a/libs/angular-integration-interface/mocks/mock-user-service.ts +++ b/libs/angular-integration-interface/mocks/mock-user-service.ts @@ -3,7 +3,7 @@ import { BehaviorSubject } from 'rxjs' export class MockUserService { lang$ = new BehaviorSubject('en') /* eslint-disable @typescript-eslint/no-unused-vars */ - hasPermission(permissionKey: string): boolean { + hasPermission(permissionKey: string | string[]): boolean { return true } } diff --git a/libs/angular-integration-interface/src/lib/model/config-key.model.ts b/libs/angular-integration-interface/src/lib/model/config-key.model.ts index 4c14ebaf..e7e59be2 100644 --- a/libs/angular-integration-interface/src/lib/model/config-key.model.ts +++ b/libs/angular-integration-interface/src/lib/model/config-key.model.ts @@ -20,6 +20,7 @@ export enum CONFIG_KEY { ONECX_PORTAL_SETTINGS_DISABLED = 'ONECX_PORTAL_SETTINGS_DISABLED', ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED = 'ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED', ONECX_PORTAL_HELP_DISABLED = 'ONECX_PORTAL_HELP_DISABLED', + ONECX_PORTAL_SEARCH_BUTTONS_REVERSED = 'ONECX_PORTAL_SEARCH_BUTTONS_REVERSED', APP_VERSION = 'APP_VERSION', IS_SHELL = 'IS_SHELL', AUTH_SERVICE = 'AUTH_SERVICE', diff --git a/libs/angular-integration-interface/src/lib/services/user.service.ts b/libs/angular-integration-interface/src/lib/services/user.service.ts index b72e95f4..50ac9e76 100644 --- a/libs/angular-integration-interface/src/lib/services/user.service.ts +++ b/libs/angular-integration-interface/src/lib/services/user.service.ts @@ -35,7 +35,10 @@ export class UserService implements OnDestroy { this.profile$.destroy() } - hasPermission(permissionKey: string): boolean { + hasPermission(permissionKey: string | string[]): boolean { + if (Array.isArray(permissionKey)) { + return permissionKey.every((key) => this.hasPermission(key)) + } const oldConceptResult = this.permissions$.getValue() ? this.permissions$.getValue()?.includes(permissionKey) : false