@netgrif/components-core
Version:
Netgrif Application engine frontend core Angular library
56 lines (55 loc) • 2.46 kB
TypeScript
import { OnDestroy } from '@angular/core';
import { UserService } from '../../user/services/user.service';
import { CaseResourceService } from '../../resources/engine-endpoint/case-resource.service';
import { Case } from '../../resources/interface/case';
import { BehaviorSubject, Observable } from 'rxjs';
import * as i0 from "@angular/core";
/**
* 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.
*/
export declare class NextGroupService implements OnDestroy {
protected _userService: UserService;
protected _caseResourceService: CaseResourceService;
protected _memberGroups$: BehaviorSubject<Array<Case>>;
protected _ownerGroups$: BehaviorSubject<Array<Case>>;
private _userSub;
constructor(_userService: UserService, _caseResourceService: CaseResourceService);
ngOnDestroy(): void;
/**
* @returns an Observable of all the groups the currently logged user is a member of
*/
get memberGroups$(): Observable<Array<Case>>;
/**
* @returns an Observable of all the groups the currently logged user is an owner of
*/
get ownerGroups$(): Observable<Array<Case>>;
/**
* @returns an Array of all the groups the currently logged user is a member of
*/
get memberGroups(): Array<Case>;
/**
* @returns an Array of all the groups the currently logged user is an owner of
*/
get ownerGroups(): Array<Case>;
/**
* @returns an Observable containing the first element of the [ownerGroups$]{@link NextGroupService#ownerGroups$} observable,
* or `undefined` if the contained array is empty
*/
get firstOwnerGroup$(): Observable<Case | undefined>;
/**
* @returns the first element of the [ownerGroups]{@link NextGroupService#ownerGroups} array, or `undefined` if the array is empty
*/
get firstOwnerGroup(): Case | undefined;
/**
* @deprecated in NAE 5.6.0 - use [ownerGroups]{@link NextGroupService#ownerGroups} instead
*/
get groupOfUser(): Array<Case>;
static ɵfac: i0.ɵɵFactoryDeclaration<NextGroupService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NextGroupService>;
}