diff --git a/nae.json b/nae.json
index 16dc91b4ba..12eecce549 100644
--- a/nae.json
+++ b/nae.json
@@ -303,21 +303,6 @@
},
"processUri": "/test"
},
- "hidden-active-group": {
- "component": {
- "class": "ActiveGroupComponent",
- "from": "./doc/active-group/active-group.component"
- },
- "access": "private",
- "navigation": {
- "title": "Active group view",
- "icon": "coronavirus",
- "hidden": false
- },
- "routing": {
- "path": "active-group"
- }
- },
"demo-breadcrumbs": {
"component": {
"class": "BreadcrumbsExampleComponent",
@@ -850,17 +835,6 @@
}
}
},
- "demo-active-group": {
- "component": {
- "class": "ActiveGroupComponent",
- "from": "./doc/active-group/active-group.component"
- },
- "access": "private",
- "navigation": true,
- "routing": {
- "path": "active-group"
- }
- },
"dashboard": {
"layout": {
"name": "dashboard",
diff --git a/projects/nae-example-app/src/app/app.module.ts b/projects/nae-example-app/src/app/app.module.ts
index f59fbd84eb..4c6501e430 100644
--- a/projects/nae-example-app/src/app/app.module.ts
+++ b/projects/nae-example-app/src/app/app.module.ts
@@ -100,7 +100,6 @@ import {ResetPasswordFormComponent} from './doc/forms/reset-password-form/reset-
import {PublicTaskViewComponent} from './doc/public-task-view/public-task-view.component';
import {PublicWorkflowViewComponent} from './doc/public-workflow-view/public-workflow-view.component';
import {PublicResolverComponent} from './doc/public-resolver/public-resolver.component';
-import {GroupViewComponent} from './doc/group-view/group-view.component';
import {
DemoTitleConfigContent0TaskViewComponent
} from './doc/demo-title-config/content/0/demo-title-config-content0-task-view.component';
@@ -115,7 +114,6 @@ import {
} from './doc/demo-title-config/content/3/demo-title-config-content3-case-view.component';
import {TitleConfigComponent} from './doc/demo-title-config/title-config.component';
import {ExampleRedirectComponent} from './doc/redirect/example-redirect.component';
-import {ActiveGroupComponent} from './doc/active-group/active-group.component';
import {WrapperEmptyViewComponent} from './views/wrapper/wrapper-empty-view.component';
import {DoubleDrawerExampleComponent} from './doc/double-drawer-example/double-drawer-example.component';
import {PublicSingleTaskViewComponent} from './doc/public-single-task-view/public-single-task-view.component';
@@ -179,14 +177,12 @@ export function HttpLoaderFactory(http: HttpClient) {
PublicTaskViewComponent,
PublicWorkflowViewComponent,
PublicResolverComponent,
- GroupViewComponent,
ExampleRedirectComponent,
DemoTitleConfigContent0TaskViewComponent,
DemoTitleConfigContent1CaseViewComponent,
DemoTitleConfigContent2CaseViewComponent,
DemoTitleConfigContent3CaseViewComponent,
TitleConfigComponent,
- ActiveGroupComponent,
WrapperEmptyViewComponent,
DoubleDrawerExampleComponent,
PublicSingleTaskViewComponent,
diff --git a/projects/nae-example-app/src/app/doc/active-group/active-group.component.html b/projects/nae-example-app/src/app/doc/active-group/active-group.component.html
deleted file mode 100644
index 90af9b4c1a..0000000000
--- a/projects/nae-example-app/src/app/doc/active-group/active-group.component.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- Active group
-
- {{group.title}}
-
-
-
- Active groups
-
- {{group.title}}
-
-
-
-
-
diff --git a/projects/nae-example-app/src/app/doc/active-group/active-group.component.scss b/projects/nae-example-app/src/app/doc/active-group/active-group.component.scss
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/projects/nae-example-app/src/app/doc/active-group/active-group.component.spec.ts b/projects/nae-example-app/src/app/doc/active-group/active-group.component.spec.ts
deleted file mode 100644
index fded585b70..0000000000
--- a/projects/nae-example-app/src/app/doc/active-group/active-group.component.spec.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import {ComponentFixture, TestBed} from '@angular/core/testing';
-import {ActiveGroupComponent} from './active-group.component';
-
-describe('ActiveGroupComponent', () => {
- let component: ActiveGroupComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async () => {
- await TestBed.configureTestingModule({
- declarations: [ActiveGroupComponent]
- })
- .compileComponents();
- });
-
- beforeEach(() => {
- fixture = TestBed.createComponent(ActiveGroupComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/projects/nae-example-app/src/app/doc/active-group/active-group.component.ts b/projects/nae-example-app/src/app/doc/active-group/active-group.component.ts
deleted file mode 100644
index ed2a89850a..0000000000
--- a/projects/nae-example-app/src/app/doc/active-group/active-group.component.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import {Component, OnDestroy} from '@angular/core';
-import {ActiveGroupService, Case, NextGroupService} from '@netgrif/components-core';
-import {FormControl} from '@angular/forms';
-import {Subscription} from 'rxjs';
-import {filter, take} from 'rxjs/operators';
-
-@Component({
- selector: 'nae-app-active-group',
- templateUrl: './active-group.component.html',
- styleUrls: ['./active-group.component.scss']
-})
-export class ActiveGroupComponent implements OnDestroy {
-
- options: Array;
-
- activeGroups: Array;
-
- fcGroup: FormControl;
- fcGroups: FormControl;
-
- private _subGroups: Subscription;
- private _subGroupFc: Subscription;
- private _subGroupsFc: Subscription;
- private _subActiveGroups: Subscription;
-
- constructor(private _activeGroupService: ActiveGroupService, private _groupService: NextGroupService) {
- this._subGroups = this._groupService.memberGroups$.subscribe(groups => {
- this.options = groups;
- });
-
- this.fcGroup = new FormControl();
- this._subGroupFc = this.fcGroup.valueChanges.subscribe((groupId: string) => {
- this._activeGroupService.activeGroup = this.options.find(it => it.stringId === groupId);
- });
-
- this.fcGroups = new FormControl();
- this._subGroupsFc = this.fcGroups.valueChanges.subscribe((groupIds: Array) => {
- this._activeGroupService.activeGroups = this.options.filter(it => groupIds.some(gid => gid === it.stringId));
- });
-
- this._subActiveGroups = this._activeGroupService.activeGroups$.subscribe(activeGroups => {
- this.activeGroups = activeGroups.map(it => it.title);
- });
-
- this._activeGroupService.activeGroups$.pipe(filter(it => it.length > 0), take(1)).subscribe(value => {
- this.fcGroup.setValue(value[0].stringId);
- this.fcGroups.setValue(value.map(it => it.stringId));
- });
- }
-
- ngOnDestroy(): void {
- this._subGroups.unsubscribe();
- this._subGroupFc.unsubscribe();
- this._subGroupsFc.unsubscribe();
- this._subActiveGroups.unsubscribe();
- }
-
- trackByFn(index, group: Case) {
- return group.stringId;
- }
-
-}
diff --git a/projects/nae-example-app/src/app/doc/group-view/group-view.component.html b/projects/nae-example-app/src/app/doc/group-view/group-view.component.html
deleted file mode 100644
index c20ab8016f..0000000000
--- a/projects/nae-example-app/src/app/doc/group-view/group-view.component.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/projects/nae-example-app/src/app/doc/group-view/group-view.component.scss b/projects/nae-example-app/src/app/doc/group-view/group-view.component.scss
deleted file mode 100644
index 52728af380..0000000000
--- a/projects/nae-example-app/src/app/doc/group-view/group-view.component.scss
+++ /dev/null
@@ -1,22 +0,0 @@
-.task-tab-background{
- height: 100%;
- width: 100%;
- overflow: auto;
- background-color: transparent;
-}
-.search-panel{
- margin-top: 20px;
-}
-.content-margin{
- margin: 0 20px;
-}
-.task-panel-padding-mini{
- padding-bottom: 20px;
- padding-top: 20px;
-}
-.full-height {
- height: 100%;
-}
-.search-width {
- width: 100%;
-}
diff --git a/projects/nae-example-app/src/app/doc/group-view/group-view.component.spec.ts b/projects/nae-example-app/src/app/doc/group-view/group-view.component.spec.ts
deleted file mode 100644
index 37cf1612c8..0000000000
--- a/projects/nae-example-app/src/app/doc/group-view/group-view.component.spec.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import {waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
-import { GroupViewComponent } from './group-view.component';
-import {
- MaterialModule,
- ConfigurationService,
- AuthenticationMethodService,
- NAE_TAB_DATA,
- SimpleFilter,
- FilterType
-} from '@netgrif/components-core';
-import {
- HeaderComponentModule,
- PanelComponentModule,
-} from '@netgrif/components';
-import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
-import {NaeExampleAppConfigurationService} from '../../nae-example-app-configuration.service';
-
-describe('GroupViewGroupViewComponent', () => {
- let component: GroupViewComponent;
- let fixture: ComponentFixture;
-
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports: [
- MaterialModule,
- HeaderComponentModule,
- PanelComponentModule,
- BrowserAnimationsModule
- ],
- providers: [
- {provide: NAE_TAB_DATA, useValue: {baseFilter: new SimpleFilter('id', FilterType.TASK, {})}},
- AuthenticationMethodService,
- {provide: ConfigurationService, useClass: NaeExampleAppConfigurationService}
- ],
- declarations: [GroupViewComponent]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(GroupViewComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/projects/nae-example-app/src/app/doc/group-view/group-view.component.ts b/projects/nae-example-app/src/app/doc/group-view/group-view.component.ts
deleted file mode 100644
index 595af86df3..0000000000
--- a/projects/nae-example-app/src/app/doc/group-view/group-view.component.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import {AfterViewInit, Component, ViewChild} from '@angular/core';
-import {
- AbstractTaskViewComponent, CategoryFactory,
- defaultTaskSearchCategoriesFactory, NAE_SEARCH_CATEGORIES, NextGroupService,
- SearchService,
- SimpleFilter, TaskSearchCaseQuery,
- TaskViewService, NAE_BASE_FILTER, AllowedNetsService, AllowedNetsServiceFactory, NAE_VIEW_ID_SEGMENT, ViewIdService,
- ChangedFieldsService
-} from '@netgrif/components-core';
-import {
- HeaderComponent,
-} from '@netgrif/components';
-
-const localAllowedNetsFactory = (factory: AllowedNetsServiceFactory) => {
- return factory.createFromConfig('group-view');
-};
-
-const baseFilterFactory = (nextGroupService: NextGroupService) => {
- const groupIds: Array = [];
- nextGroupService.groupOfUser.forEach(group => {
- groupIds.push({id: group.stringId});
- });
- return {
- filter: SimpleFilter.fromTaskQuery({case: groupIds})
- };
-};
-
-@Component({
- selector: 'nae-app-group-view-group-view',
- templateUrl: './group-view.component.html',
- styleUrls: ['./group-view.component.scss'],
- providers: [
- CategoryFactory,
- TaskViewService,
- SearchService,
- ChangedFieldsService,
- {
- provide: NAE_BASE_FILTER,
- useFactory: baseFilterFactory,
- deps: [NextGroupService]
- },
- {
- provide: AllowedNetsService,
- useFactory: localAllowedNetsFactory,
- deps: [AllowedNetsServiceFactory]
- },
- {provide: NAE_VIEW_ID_SEGMENT, useValue: 'group'},
- ViewIdService,
- {provide: NAE_SEARCH_CATEGORIES, useFactory: defaultTaskSearchCategoriesFactory, deps: [CategoryFactory]},
- ]
-})
-export class GroupViewComponent extends AbstractTaskViewComponent implements AfterViewInit {
-
- @ViewChild('header') public taskHeaderComponent: HeaderComponent;
-
- constructor(taskViewService: TaskViewService) {
- super(taskViewService);
-
- }
-
- ngAfterViewInit(): void {
- this.initializeHeader(this.taskHeaderComponent);
- }
-}
diff --git a/projects/nae-example-app/src/app/nae-example-app-view.service.ts b/projects/nae-example-app/src/app/nae-example-app-view.service.ts
index 35008bfb61..20a3530992 100644
--- a/projects/nae-example-app/src/app/nae-example-app-view.service.ts
+++ b/projects/nae-example-app/src/app/nae-example-app-view.service.ts
@@ -28,10 +28,8 @@ import {LdapGroupRolesAssignComponent} from './doc/ldap-group-roles-assign/ldap-
import {TreeViewExampleComponent} from './doc/tree-view-example/tree-view-example.component';
import {UserInviteComponent} from './doc/user-invite/user-invite.component';
import {ResetPasswordFormComponent} from './doc/forms/reset-password-form/reset-password-form.component';
-import {GroupViewComponent} from './doc/group-view/group-view.component';
import {TitleConfigComponent} from './doc/demo-title-config/title-config.component';
import {ExampleRedirectComponent} from './doc/redirect/example-redirect.component';
-import {ActiveGroupComponent} from './doc/active-group/active-group.component';
import {WrapperEmptyViewComponent} from './views/wrapper/wrapper-empty-view.component';
import {DoubleDrawerExampleComponent} from './doc/double-drawer-example/double-drawer-example.component';
import {BreadcrumbsExampleComponent} from './doc/breadcrumbs-example/breadcrumbs-example.component';
@@ -63,9 +61,7 @@ export class NaeExampleAppViewService extends ViewService {
{id: 'TitleConfigComponent', class: TitleConfigComponent},
{id: 'PublicSingleTaskViewComponent', class: DefaultPublicSingleTaskViewComponent},
{id: 'WrapperEmptyViewComponent', class: WrapperEmptyViewComponent},
- {id: 'ActiveGroupComponent', class: ActiveGroupComponent},
{id: 'ExampleRedirectComponent', class: ExampleRedirectComponent},
- {id: 'GroupViewComponent', class: GroupViewComponent},
{id: 'UserInviteComponent', class: UserInviteComponent},
{id: 'TreeViewExampleComponent', class: TreeViewExampleComponent},
{id: 'ButtonsNavComponent', class: ButtonsNavComponent},
diff --git a/projects/netgrif-components-core/src/lib/authentication/models/user.transformer.spec.ts b/projects/netgrif-components-core/src/lib/authentication/models/user.transformer.spec.ts
index df8d4dcc4f..f94d7787e1 100644
--- a/projects/netgrif-components-core/src/lib/authentication/models/user.transformer.spec.ts
+++ b/projects/netgrif-components-core/src/lib/authentication/models/user.transformer.spec.ts
@@ -19,9 +19,9 @@ describe('UserTransformer', () => {
lastName: 'string',
fullName: 'string string',
groups: [],
- authorities: [{authority: 'ADMIN'}],
+ authorities: [{name: 'ADMIN', authority: 'ADMIN'}],
processRoles: [{stringId: 'string', description: 'desc', name: 'name', importId: 'importId'}],
- nextGroups: [],
+ groupIds: [],
_links: {},
}).fullName).toEqual('string string');
});
diff --git a/projects/netgrif-components-core/src/lib/authentication/models/user.transformer.ts b/projects/netgrif-components-core/src/lib/authentication/models/user.transformer.ts
index 1fb77ba406..f8f15be4fd 100644
--- a/projects/netgrif-components-core/src/lib/authentication/models/user.transformer.ts
+++ b/projects/netgrif-components-core/src/lib/authentication/models/user.transformer.ts
@@ -25,8 +25,8 @@ export class UserTransformer implements Transformer {
user.lastName,
this.transformAuthorities(user.authorities),
user.processRoles,
- groups,
- user.nextGroups,
+ user.groupIds,
+ user.groups,
user.impersonated ? this.transform(user.impersonated) : undefined);
}
diff --git a/projects/netgrif-components-core/src/lib/authorization/group/group-guard.service.ts b/projects/netgrif-components-core/src/lib/authorization/group/group-guard.service.ts
index 3334b5d6f9..095b7553ac 100644
--- a/projects/netgrif-components-core/src/lib/authorization/group/group-guard.service.ts
+++ b/projects/netgrif-components-core/src/lib/authorization/group/group-guard.service.ts
@@ -7,7 +7,6 @@ import {UserService} from '../../user/services/user.service';
import {ConfigurationService} from '../../configuration/configuration.service';
import {LoggerService} from '../../logger/services/logger.service';
import {View} from '../../../commons/schema';
-import {NextGroupService} from '../../groups/services/next-group.service';
@Injectable({
providedIn: AuthenticationModule
@@ -18,7 +17,6 @@ export class GroupGuardService implements CanActivate {
constructor(protected _redirectService: RedirectService,
protected _userService: UserService,
- protected _nextGroupService: NextGroupService,
protected _configService: ConfigurationService,
protected _log: LoggerService) {
this._loginUrl = this._redirectService.resolveLoginPath();
@@ -39,7 +37,7 @@ export class GroupGuardService implements CanActivate {
} else {
allowedGroups = [view.access.group];
}
- const groupOfUser = this._nextGroupService.groupOfUser.map(group => group.title);
+ const groupOfUser = this._userService.user.groups.map(group => group.displayName);
return allowedGroups.some(groupTitle => {
return groupOfUser.includes(groupTitle);
diff --git a/projects/netgrif-components-core/src/lib/authorization/permission/permission.service.ts b/projects/netgrif-components-core/src/lib/authorization/permission/permission.service.ts
index 27d6398cc4..71a52f85ca 100644
--- a/projects/netgrif-components-core/src/lib/authorization/permission/permission.service.ts
+++ b/projects/netgrif-components-core/src/lib/authorization/permission/permission.service.ts
@@ -113,14 +113,14 @@ export class PermissionService {
const processedActorIds: Array = [];
Object.keys(users).forEach(actorId => {
if (userPermValue === false || processedActorIds.includes(actorId)
- || actorId !== loggedUser.id && !loggedUser.nextGroups?.includes(actorId)) {
+ || actorId !== loggedUser.id && !loggedUser.groupIds.includes(actorId)) {
return;
}
let currentUserPermission: boolean = this.getPermissionByUserOrGroup(users, permission, loggedUser);
if (currentUserPermission !== undefined) {
userPermValue = userPermValue === undefined ? currentUserPermission : userPermValue && currentUserPermission;
}
- loggedUser.nextGroups !== undefined ? processedActorIds.push(actorId, ...loggedUser.nextGroups) : processedActorIds.push(actorId);
+ loggedUser.groupIds !== undefined ? processedActorIds.push(actorId, ...loggedUser.groupIds) : processedActorIds.push(actorId);
});
}
return userPermValue;
@@ -131,10 +131,10 @@ export class PermissionService {
if (permissions[loggedUser.id] !== undefined) {
userPermValue = permissions[loggedUser.id][permission];
}
- if (loggedUser.nextGroups === undefined || loggedUser.nextGroups.length === 0 || userPermValue === false) {
+ if (loggedUser.groupIds === undefined || loggedUser.groupIds.length === 0 || userPermValue === false) {
return userPermValue;
}
- loggedUser.nextGroups.forEach(function(groupId) {
+ loggedUser.groupIds.forEach(function(groupId) {
if (permissions[groupId] !== undefined && permissions[groupId][permission] !== undefined) {
userPermValue = userPermValue === undefined ?
permissions[groupId][permission] : userPermValue && permissions[groupId][permission];
diff --git a/projects/netgrif-components-core/src/lib/groups/public-api.ts b/projects/netgrif-components-core/src/lib/groups/public-api.ts
index 67e4c0eb20..0a73889833 100644
--- a/projects/netgrif-components-core/src/lib/groups/public-api.ts
+++ b/projects/netgrif-components-core/src/lib/groups/public-api.ts
@@ -1,3 +1 @@
-export * from './services/next-group.service';
-export * from './services/active-group.service';
export * from './services/ldap-group-list.service';
diff --git a/projects/netgrif-components-core/src/lib/groups/services/active-group.service.spec.ts b/projects/netgrif-components-core/src/lib/groups/services/active-group.service.spec.ts
deleted file mode 100644
index 688eb3a547..0000000000
--- a/projects/netgrif-components-core/src/lib/groups/services/active-group.service.spec.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import {TestBed} from '@angular/core/testing';
-import {ActiveGroupService} from './active-group.service';
-import {TestMockDependenciesModule} from '../../utility/tests/test-mock-dependencies.module';
-import {NoopAnimationsModule} from '@angular/platform-browser/animations';
-import {HttpClientTestingModule} from '@angular/common/http/testing';
-
-describe('ActiveGroupService', () => {
- let service: ActiveGroupService;
-
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- HttpClientTestingModule,
- NoopAnimationsModule,
- TestMockDependenciesModule
- ]
- });
- service = TestBed.inject(ActiveGroupService);
- });
-
- it('should be created', () => {
- expect(service).toBeTruthy();
- });
-
- afterEach(() => {
- TestBed.resetTestingModule();
- });
-});
diff --git a/projects/netgrif-components-core/src/lib/groups/services/active-group.service.ts b/projects/netgrif-components-core/src/lib/groups/services/active-group.service.ts
deleted file mode 100644
index 9100a6f920..0000000000
--- a/projects/netgrif-components-core/src/lib/groups/services/active-group.service.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import {Injectable, OnDestroy} from '@angular/core';
-import {BehaviorSubject, Observable, Subscription} from 'rxjs';
-import {Case} from '../../resources/interface/case';
-import {NextGroupService} from './next-group.service';
-import {map} from 'rxjs/operators';
-
-/**
- * This service to the groups that are "active" for the logged user.
- *
- * The meaning of "active" can wary from application to application. And this service provides the utility to track this state.
- *
- * The active groups are assumed to be a subset of the groups the logged user is a member of,
- * but this assumption is not enforced nor checked.
- *
- * If at most one group can be active at a time, this service provides utility methods to access this group directly.
- *
- * The groups are assumed to be instances of the engine group process, this is never checked nor enforced.
- *
- * In the default implementation the initially active groups are all the groups the logged user is a member of.
- */
-@Injectable({
- providedIn: 'root'
-})
-export class ActiveGroupService implements OnDestroy {
-
- protected _activeGroups$: BehaviorSubject>;
-
- private _groupSub: Subscription;
-
- constructor(protected _groupService: NextGroupService) {
- this._activeGroups$ = new BehaviorSubject>([]);
- this._groupSub = this._groupService.memberGroups$.subscribe(groups => {
- this._activeGroups$.next(groups);
- });
- }
-
- ngOnDestroy(): void {
- this._groupSub.unsubscribe();
- this._activeGroups$.complete();
- }
-
- /**
- * In the default implementation this stream copies the values of the [memberGroups$]{@link NextGroupService#memberGroups$} stream
- * of the {@link NextGroupService}. Whenever the copies stream emits, the underlying stream in this class emits the same value.
- *
- * @returns an Observable of all the groups that are currently active
- */
- get activeGroups$(): Observable> {
- return this._activeGroups$.asObservable();
- }
-
- get activeGroups(): Array {
- return this._activeGroups$.getValue();
- }
-
- set activeGroups(activeGroups: Array) {
- this._activeGroups$.next(activeGroups);
- }
-
- /**
- * @returns an Observable containing the first element of the [activeGroups$]{@link ActiveGroupService#activeGroups$} observable,
- * or `undefined` if the contained array is empty
- */
- get activeGroup$(): Observable {
- return this.activeGroups$.pipe(map(array => array.length > 0 ? array[0] : undefined));
- }
-
- /**
- * @returns the first element of the [activeGroups]{@link ActiveGroupService#activeGroups} array, or `undefined` if the array is empty
- */
- get activeGroup(): Case | undefined {
- const activeGroups = this.activeGroups;
- return activeGroups.length > 0 ? activeGroups[0] : undefined;
- }
-
- /**
- * Emits a new array into the [activeGroups$]{@link ActiveGroupService#activeGroups$} observable, that contains only
- * the provided {@link Case} object. If `undefined` is passed as argument, an empty array will be pushed into the observable.
- * @param activeGroup the new active group case reference
- */
- set activeGroup(activeGroup: Case) {
- if (activeGroup === undefined) {
- this._activeGroups$.next([]);
- } else {
- this._activeGroups$.next([activeGroup]);
- }
- }
-}
diff --git a/projects/netgrif-components-core/src/lib/groups/services/next-group-service.spec.ts b/projects/netgrif-components-core/src/lib/groups/services/next-group-service.spec.ts
deleted file mode 100644
index 551e8adc8f..0000000000
--- a/projects/netgrif-components-core/src/lib/groups/services/next-group-service.spec.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import {TestBed} from '@angular/core/testing';
-import {NextGroupService} from './next-group.service';
-import {HttpClientTestingModule} from '@angular/common/http/testing';
-import {NoopAnimationsModule} from '@angular/platform-browser/animations';
-import {ConfigurationService} from '../../configuration/configuration.service';
-import {TestConfigurationService} from '../../utility/tests/test-config';
-import {MockUserService} from '../../utility/tests/mocks/mock-user.service';
-import {UserService} from '../../user/services/user.service';
-import {CaseResourceService} from '../../resources/engine-endpoint/case-resource.service';
-import {MockCaseResourceService} from '../../utility/tests/mocks/mock-case-resource.service';
-
-describe('NextGroupService', () => {
- let service: NextGroupService;
-
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- HttpClientTestingModule,
- NoopAnimationsModule
- ],
- providers: [
- {provide: UserService, useClass: MockUserService},
- {provide: CaseResourceService, useClass: MockCaseResourceService},
- {provide: ConfigurationService, useClass: TestConfigurationService}
- ]
- });
- service = TestBed.inject(NextGroupService);
- });
-
- it('should be created', () => {
- expect(service).toBeTruthy();
- });
-
- afterEach(() => {
- TestBed.resetTestingModule();
- });
-});
diff --git a/projects/netgrif-components-core/src/lib/groups/services/next-group.service.ts b/projects/netgrif-components-core/src/lib/groups/services/next-group.service.ts
deleted file mode 100644
index 759a934fda..0000000000
--- a/projects/netgrif-components-core/src/lib/groups/services/next-group.service.ts
+++ /dev/null
@@ -1,111 +0,0 @@
-import {Injectable, OnDestroy} from '@angular/core';
-import {UserService} from '../../user/services/user.service';
-import {CaseResourceService} from '../../resources/engine-endpoint/case-resource.service';
-import {SimpleFilter} from '../../filter/models/simple-filter';
-import {HttpParams} from '@angular/common/http';
-import {map, switchMap} from 'rxjs/operators';
-import {Case} from '../../resources/interface/case';
-import {BehaviorSubject, Observable, of, Subscription} from 'rxjs';
-import {PaginationParams} from '../../utility/pagination/pagination-params';
-
-/**
- * This service allows access to information about the groups of the currently logged user.
- *
- * If no user is logged an empty array is provided.
- *
- * If a user can be owner of at most one group, this service provides utility methods to access this group directly.
- *
- * The groups are assumed to be instances of the engine group process, this is never checked nor enforced.
- */
-@Injectable({
- providedIn: 'root'
-})
-export class NextGroupService implements OnDestroy {
-
- protected _memberGroups$: BehaviorSubject>;
- protected _ownerGroups$: BehaviorSubject>;
-
- private _userSub: Subscription;
-
- constructor(protected _userService: UserService, protected _caseResourceService: CaseResourceService) {
- this._ownerGroups$ = new BehaviorSubject>([]);
- this._memberGroups$ = new BehaviorSubject>([]);
-
- this._userSub = this._userService.user$.pipe(
- switchMap(user => {
- if (!user || user.id === '') {
- return of([]);
- }
-
- const params = new HttpParams().set(PaginationParams.PAGE_SIZE, `${(user as any).nextGroups.length}`);
-
- return this._caseResourceService.searchCases(SimpleFilter.fromCaseQuery({id: (user as any).nextGroups}), params)
- .pipe(
- map(page => page.content ? page.content : []),
- map(groups => groups.filter(group => group.author.fullName !== 'application engine'))
- );
- })
- ).subscribe(groups => {
- const ownerGroups = groups.filter(g => g.author.email === this._userService.user.email);
- this._ownerGroups$.next(ownerGroups);
- this._memberGroups$.next(groups);
- });
- }
-
- ngOnDestroy(): void {
- this._userSub.unsubscribe();
- this._memberGroups$.complete();
- this._ownerGroups$.complete();
- }
-
- /**
- * @returns an Observable of all the groups the currently logged user is a member of
- */
- public get memberGroups$(): Observable> {
- return this._memberGroups$.asObservable();
- }
-
- /**
- * @returns an Observable of all the groups the currently logged user is an owner of
- */
- public get ownerGroups$(): Observable> {
- return this._ownerGroups$.asObservable();
- }
-
- /**
- * @returns an Array of all the groups the currently logged user is a member of
- */
- public get memberGroups(): Array {
- return this._memberGroups$.getValue();
- }
-
- /**
- * @returns an Array of all the groups the currently logged user is an owner of
- */
- public get ownerGroups(): Array {
- return this._ownerGroups$.getValue();
- }
-
- /**
- * @returns an Observable containing the first element of the [ownerGroups$]{@link NextGroupService#ownerGroups$} observable,
- * or `undefined` if the contained array is empty
- */
- public get firstOwnerGroup$(): Observable {
- return this._ownerGroups$.pipe(map(array => array.length > 0 ? array[0] : undefined));
- }
-
- /**
- * @returns the first element of the [ownerGroups]{@link NextGroupService#ownerGroups} array, or `undefined` if the array is empty
- */
- public get firstOwnerGroup(): Case | undefined {
- const ownerGroups = this.ownerGroups;
- return ownerGroups.length > 0 ? ownerGroups[0] : undefined;
- }
-
- /**
- * @deprecated in NAE 5.6.0 - use [ownerGroups]{@link NextGroupService#ownerGroups} instead
- */
- get groupOfUser(): Array {
- return this.ownerGroups;
- }
-}
diff --git a/projects/netgrif-components-core/src/lib/impersonation/services/impersonation.service.spec.ts b/projects/netgrif-components-core/src/lib/impersonation/services/impersonation.service.spec.ts
index 2cde3fd2bf..236ac13666 100644
--- a/projects/netgrif-components-core/src/lib/impersonation/services/impersonation.service.spec.ts
+++ b/projects/netgrif-components-core/src/lib/impersonation/services/impersonation.service.spec.ts
@@ -119,7 +119,7 @@ class TestUserService {
public userObj = new User('id', 'mail', '', '', '', '', [], [{stringId: 'role'} as ProcessRole], [], []);
public userObjAfter = new User(
- this.userObj.id, this.userObj.username, this.userObj.email, this.userObj.realmId, this.userObj.firstName, this.userObj.lastName, this.userObj.authorities, this.userObj.roles, this.userObj.groups, this.userObj.nextGroups,
+ this.userObj.id, this.userObj.username, this.userObj.email, this.userObj.realmId, this.userObj.firstName, this.userObj.lastName, this.userObj.authorities, this.userObj.roles, this.userObj.groupIds, this.userObj.groups,
new User('impId', 'mail', '', '', '', '', [], [{stringId: 'role'} as ProcessRole], [], []),
);
diff --git a/projects/netgrif-components-core/src/lib/navigation/navigation-tree/abstract-navigation-tree.component.spec.ts b/projects/netgrif-components-core/src/lib/navigation/navigation-tree/abstract-navigation-tree.component.spec.ts
index 1ed4b54e37..110267d5a9 100644
--- a/projects/netgrif-components-core/src/lib/navigation/navigation-tree/abstract-navigation-tree.component.spec.ts
+++ b/projects/netgrif-components-core/src/lib/navigation/navigation-tree/abstract-navigation-tree.component.spec.ts
@@ -23,7 +23,6 @@ import {UserTransformer} from '../../authentication/models/user.transformer';
import {SessionService} from '../../authentication/session/services/session.service';
import {User} from '../../user/models/user';
import {AnonymousService} from '../../authentication/anonymous/anonymous.service';
-import {ActiveGroupService} from '../../groups/services/active-group.service';
import {TaskResourceService} from '../../resources/engine-endpoint/task-resource.service';
import {LanguageService} from '../../translate/language.service';
import {
@@ -357,7 +356,6 @@ class TestTreeComponent extends AbstractNavigationTreeComponent {
log: LoggerService,
userService: UserService,
accessService: AccessService,
- activeGroupService: ActiveGroupService,
taskResourceService: TaskResourceService,
languageService: LanguageService,
navigationRouteProvider: DynamicNavigationRouteProviderService) {
@@ -367,7 +365,6 @@ class TestTreeComponent extends AbstractNavigationTreeComponent {
log,
userService,
accessService,
- activeGroupService,
taskResourceService,
languageService,
navigationRouteProvider
diff --git a/projects/netgrif-components-core/src/lib/navigation/navigation-tree/abstract-navigation-tree.component.ts b/projects/netgrif-components-core/src/lib/navigation/navigation-tree/abstract-navigation-tree.component.ts
index 0a6f0a68f1..17e2d06333 100644
--- a/projects/netgrif-components-core/src/lib/navigation/navigation-tree/abstract-navigation-tree.component.ts
+++ b/projects/netgrif-components-core/src/lib/navigation/navigation-tree/abstract-navigation-tree.component.ts
@@ -10,7 +10,6 @@ import {UserService} from '../../user/services/user.service';
import {
AbstractNavigationResizableDrawerComponent
} from '../navigation-drawer/abstract-navigation-resizable-drawer.component';
-import {ActiveGroupService} from '../../groups/services/active-group.service';
import {debounceTime, filter} from 'rxjs/operators';
import {TaskResourceService} from '../../resources/engine-endpoint/task-resource.service';
import {LanguageService} from '../../translate/language.service';
@@ -52,7 +51,6 @@ export abstract class AbstractNavigationTreeComponent extends AbstractNavigation
protected _log: LoggerService,
protected _userService: UserService,
protected _accessService: AccessService,
- protected _activeGroupService: ActiveGroupService,
protected _taskResourceService: TaskResourceService,
protected _languageService: LanguageService,
protected _navigationRouteProvider: DynamicNavigationRouteProviderService) {
@@ -74,7 +72,6 @@ export abstract class AbstractNavigationTreeComponent extends AbstractNavigation
this._router.events.pipe(filter(event => event instanceof NavigationEnd && this.routerChange))
.subscribe(() => this._reloadNavigation.next()),
this._userService.user$.subscribe(() => this._reloadNavigation.next()),
- this._activeGroupService.activeGroups$.subscribe(() => this._reloadNavigation.next())
];
this._subscriptions.push(
diff --git a/projects/netgrif-components-core/src/lib/resources/interface/authority.ts b/projects/netgrif-components-core/src/lib/resources/interface/authority.ts
index b3a0887196..518d44e622 100644
--- a/projects/netgrif-components-core/src/lib/resources/interface/authority.ts
+++ b/projects/netgrif-components-core/src/lib/resources/interface/authority.ts
@@ -4,10 +4,6 @@
* Authority: ROLE_USER | ROLE_ADMIN | ROLE_SYSTEMADMIN | Custom Role
*/
export interface Authority {
- /**
- * Spring Boot Role
- *
- * **Example:** ROLE_SYSTEMADMIN
- */
+ name: string;
authority: 'ROLE_USER' | 'ROLE_ADMIN' | 'ROLE_SYSTEMADMIN' | string;
}
diff --git a/projects/netgrif-components-core/src/lib/resources/interface/group.ts b/projects/netgrif-components-core/src/lib/resources/interface/group.ts
index a764e44185..38c5a1ce64 100644
--- a/projects/netgrif-components-core/src/lib/resources/interface/group.ts
+++ b/projects/netgrif-components-core/src/lib/resources/interface/group.ts
@@ -1,3 +1,5 @@
+import {ProcessRole} from "./process-role";
+import {Authority} from "./authority";
export interface GroupsInterface {
groups: [];
@@ -15,7 +17,15 @@ export interface GroupInterface {
* Object from Backend
*/
export interface Group {
- id: number;
- members: Array;
- childGroups: Array;
+ id: string;
+ displayName: string;
+ realmId: string;
+ identifier: string;
+ ownerId: string;
+ ownerUsername: string;
+ processRoles?: ProcessRole[];
+ authoritySet?: Authority[];
+ groupIds?: string[];
+ subGroupIds?: string[];
+ memberIds?: string[];
}
diff --git a/projects/netgrif-components-core/src/lib/resources/interface/user-resource.ts b/projects/netgrif-components-core/src/lib/resources/interface/user-resource.ts
index 4f13336f87..aa99b9914d 100644
--- a/projects/netgrif-components-core/src/lib/resources/interface/user-resource.ts
+++ b/projects/netgrif-components-core/src/lib/resources/interface/user-resource.ts
@@ -11,7 +11,7 @@ export interface UserResource extends UserResourceSmall {
telNumber?: string;
groups: Array;
authorities: Array;
- nextGroups: Array;
+ groupIds: Array;
processRoles: Array;
impersonated?: UserResource;
_links?: any;
diff --git a/projects/netgrif-components-core/src/lib/search/models/category/user-autocomplete.spec.ts b/projects/netgrif-components-core/src/lib/search/models/category/user-autocomplete.spec.ts
index 5df694ae1b..88857d2aa3 100644
--- a/projects/netgrif-components-core/src/lib/search/models/category/user-autocomplete.spec.ts
+++ b/projects/netgrif-components-core/src/lib/search/models/category/user-autocomplete.spec.ts
@@ -152,7 +152,7 @@ class MockUserResourceService {
fullName: `${user.name} ${user.surname}`,
groups: [],
authorities: [],
- nextGroups: [],
+ groupIds: [],
processRoles: [],
}))));
}
diff --git a/projects/netgrif-components-core/src/lib/user/models/user.ts b/projects/netgrif-components-core/src/lib/user/models/user.ts
index 86786fc2ca..0e08ba01e0 100644
--- a/projects/netgrif-components-core/src/lib/user/models/user.ts
+++ b/projects/netgrif-components-core/src/lib/user/models/user.ts
@@ -1,5 +1,6 @@
import {ProcessRole} from '../../resources/interface/process-role';
import {IUser} from './iuser';
+import {Group} from "../../resources/interface/group";
/**
* The user object that is used by the frontend in its logic.
@@ -15,8 +16,8 @@ export class User implements IUser {
public lastName: string,
public authorities: Array,
public roles: Array,
- public groups?: Array,
- public nextGroups?: Array,
+ public groupIds?: Array,
+ public groups?: Group[],
public impersonated?: User
) {
}
@@ -59,5 +60,4 @@ export class User implements IUser {
public isImpersonating(): boolean {
return !!this.impersonated;
}
-
}
diff --git a/projects/netgrif-components-core/src/lib/utility/tests/mocks/mock-authentication-method-service.ts b/projects/netgrif-components-core/src/lib/utility/tests/mocks/mock-authentication-method-service.ts
index 3bf1ab5798..1e8b424c66 100644
--- a/projects/netgrif-components-core/src/lib/utility/tests/mocks/mock-authentication-method-service.ts
+++ b/projects/netgrif-components-core/src/lib/utility/tests/mocks/mock-authentication-method-service.ts
@@ -6,7 +6,7 @@ import {UserResource} from '../../../resources/interface/user-resource';
export class MockAuthenticationMethodService extends AuthenticationMethodService {
login(credentials: Credentials): Observable {
return of({email: 'mail', id: 'id', username: 'username', realmId: 'realmId', name: 'name', firstName: 'name', surname: 'surname', lastName: 'surname', fullName: 'name surname',
- groups: [], authorities: [], nextGroups: [], processRoles: []});
+ groups: [], authorities: [], groupIds: [], processRoles: []});
}
logout(): Observable