@ieeesa-npm/groups 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,8 @@ import { MatTreeNodePadding } from '@angular/material/tree';
7
7
  import { GroupInfo } from '../../models/group-info.model';
8
8
  import { EditGroupAndParentInfo } from '../../models/edit-group.model';
9
9
  import { GroupsService } from '../../services/groups.service';
10
+ import { PermissionType } from '../../models/permission-type.model';
11
+ import { GroupPermission } from '../../models/group-permissions.model';
10
12
  import * as i0 from "@angular/core";
11
13
  /**
12
14
  * Dynamic Flat node creates a node structure
@@ -131,6 +133,7 @@ export declare class TreeViewComponent implements OnInit, AfterViewInit, OnDestr
131
133
  plusCircleIconButton: IconButton;
132
134
  minusCircleIconButton: IconButton;
133
135
  editGroupAndParentGroupInfo: EditGroupAndParentInfo;
136
+ permissionType: typeof PermissionType;
134
137
  menuItems: Menu[];
135
138
  private parentGroups;
136
139
  set parentGroupsInfo(value: GroupInfo[]);
@@ -144,6 +147,7 @@ export declare class TreeViewComponent implements OnInit, AfterViewInit, OnDestr
144
147
  private deletedGroupId;
145
148
  set deletedGroupIdInfo(id: string | undefined);
146
149
  get deletedGroupIdInfo(): string | undefined;
150
+ userGroupPermissions: GroupPermission[];
147
151
  toggleGroupClick: EventEmitter<GroupInfo>;
148
152
  createGroupClick: EventEmitter<GroupInfo>;
149
153
  editGroupClick: EventEmitter<EditGroupAndParentInfo>;
@@ -255,5 +259,5 @@ export declare class TreeViewComponent implements OnInit, AfterViewInit, OnDestr
255
259
  */
256
260
  ngOnDestroy(): void;
257
261
  static ɵfac: i0.ɵɵFactoryDeclaration<TreeViewComponent, never>;
258
- static ɵcmp: i0.ɵɵComponentDeclaration<TreeViewComponent, "ieeesa-tree", never, { "parentGroupsInfo": { "alias": "parentGroupsInfo"; "required": false; }; "childGroupsInfo": { "alias": "childGroupsInfo"; "required": false; }; "isGroupSearchOrFilterActive": { "alias": "isGroupSearchOrFilterActive"; "required": false; }; "deletedGroupIdInfo": { "alias": "deletedGroupIdInfo"; "required": false; }; }, { "toggleGroupClick": "toggleGroupClick"; "createGroupClick": "createGroupClick"; "editGroupClick": "editGroupClick"; "deleteGroupClick": "deleteGroupClick"; "viewRosterClick": "viewRosterClick"; }, never, never, true, never>;
262
+ static ɵcmp: i0.ɵɵComponentDeclaration<TreeViewComponent, "ieeesa-tree", never, { "parentGroupsInfo": { "alias": "parentGroupsInfo"; "required": false; }; "childGroupsInfo": { "alias": "childGroupsInfo"; "required": false; }; "isGroupSearchOrFilterActive": { "alias": "isGroupSearchOrFilterActive"; "required": false; }; "deletedGroupIdInfo": { "alias": "deletedGroupIdInfo"; "required": false; }; "userGroupPermissions": { "alias": "userGroupPermissions"; "required": false; }; }, { "toggleGroupClick": "toggleGroupClick"; "createGroupClick": "createGroupClick"; "editGroupClick": "editGroupClick"; "deleteGroupClick": "deleteGroupClick"; "viewRosterClick": "viewRosterClick"; }, never, never, true, never>;
259
263
  }
@@ -41,6 +41,12 @@ export declare class ViewRosterComponent implements AfterViewInit, OnDestroy {
41
41
  * @memberof ViewRosterComponent
42
42
  */
43
43
  ngAfterViewInit(): void;
44
+ /**
45
+ * Hides or shows roster add user, edit user and delete user actions based on user group permissions.
46
+ * @return {boolean}
47
+ * @memberof ViewRosterComponent
48
+ */
49
+ getManageRosterActionsPermission(): boolean;
44
50
  /**
45
51
  * Gets the group users by calling getGroupUsers() from groupService and sets tableData to display the users in a grid.
46
52
  * @memberof ViewRosterComponent
@@ -4,12 +4,15 @@ import { MatDialog } from '@angular/material/dialog';
4
4
  import { GroupsService } from './services/groups.service';
5
5
  import { Subject } from 'rxjs';
6
6
  import { GroupInfo } from './models/group-info.model';
7
- import { SelectOption, IconButton, AlignType, Legend } from '@ieeesa-npm/presentation';
7
+ import { SelectOption, IconButton, AlignType, Legend, SearchType } from '@ieeesa-npm/presentation';
8
8
  import { GroupTypeConfigValue } from './models/group-types.model';
9
9
  import { AlertType, BreakpointObserverService, AlertsService, GlobalErrorHandlerService } from '@ieeesa-npm/utility';
10
10
  import { GroupFunctionType } from './models/group-function-type.model';
11
11
  import { GetGroupsPayload } from './models/view-group.model';
12
12
  import { EditGroupAndParentInfo } from './models/edit-group.model';
13
+ import { UserPermissionsService } from './services/user-permissions.service';
14
+ import { GroupPermission, UserPermission } from './models/group-permissions.model';
15
+ import { PermissionType } from './models/permission-type.model';
13
16
  import * as i0 from "@angular/core";
14
17
  /**
15
18
  * Groups component is a wrapper or container component for groups management reusable component and in this component integrates all group management functionalities and this will be entry component for managing groups when it is consumed in other applications.
@@ -21,6 +24,7 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
21
24
  alertService: AlertsService;
22
25
  private breakpointObserverService;
23
26
  globalErrorHandlerService: GlobalErrorHandlerService;
27
+ private userPermissionsService;
24
28
  destroy$: Subject<boolean>;
25
29
  dialogRef: any;
26
30
  constants: any;
@@ -52,18 +56,31 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
52
56
  };
53
57
  applicationId: string;
54
58
  apiBaseURL: string;
55
- permissions: any;
59
+ userPermissions: UserPermission[];
60
+ permissionType: typeof PermissionType;
56
61
  functionType: GroupFunctionType;
57
62
  alignmentType: typeof AlignType;
58
63
  isSorting: boolean;
59
64
  canReopenViewRosterModal: boolean;
60
- constructor(dialog: MatDialog, groupsService: GroupsService, alertService: AlertsService, breakpointObserverService: BreakpointObserverService, globalErrorHandlerService: GlobalErrorHandlerService);
65
+ searchType: SearchType;
66
+ minCharacterToSearch: number;
67
+ trimmedSearchTerm: string;
68
+ userGroupPermissions: GroupPermission[];
69
+ supportMessage: string;
70
+ constructor(dialog: MatDialog, groupsService: GroupsService, alertService: AlertsService, breakpointObserverService: BreakpointObserverService, globalErrorHandlerService: GlobalErrorHandlerService, userPermissionsService: UserPermissionsService);
61
71
  /**
62
72
  * Initialize the groups component.
63
73
  * @return -returns nothing
64
74
  * @memberof GroupsComponent
65
75
  */
66
76
  ngOnInit(): void;
77
+ /**
78
+ * Validates permission based access for provided feature.
79
+ * @param {PermissionType} permissionType
80
+ * @return {boolean}
81
+ * @memberof GroupsComponent
82
+ */
83
+ validateAccess(permissionType: PermissionType): boolean;
67
84
  /**
68
85
  * Sets the dialog options for create group modal and calls openModal method.
69
86
  * @param {GroupInfo} [parentGroupInfo] -An optional parameter. Parent group info to be passed for create child group.
@@ -183,5 +200,5 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
183
200
  */
184
201
  ngOnDestroy(): void;
185
202
  static ɵfac: i0.ɵɵFactoryDeclaration<GroupsComponent, never>;
186
- static ɵcmp: i0.ɵɵComponentDeclaration<GroupsComponent, "ieeesa-groups", never, { "groupsPageInfo": { "alias": "groupsPageInfo"; "required": false; }; "applicationId": { "alias": "applicationId"; "required": false; }; "apiBaseURL": { "alias": "apiBaseURL"; "required": false; }; "permissions": { "alias": "permissions"; "required": false; }; }, {}, never, never, true, never>;
203
+ static ɵcmp: i0.ɵɵComponentDeclaration<GroupsComponent, "ieeesa-groups", never, { "groupsPageInfo": { "alias": "groupsPageInfo"; "required": false; }; "applicationId": { "alias": "applicationId"; "required": false; }; "apiBaseURL": { "alias": "apiBaseURL"; "required": false; }; "userPermissions": { "alias": "userPermissions"; "required": false; }; }, {}, never, never, true, never>;
187
204
  }
@@ -0,0 +1,9 @@
1
+ export interface GroupPermission {
2
+ permissionName: string;
3
+ permissionType: string;
4
+ permissionId: string;
5
+ }
6
+ export interface UserPermission {
7
+ permissionName: string;
8
+ permissionId: string;
9
+ }
@@ -0,0 +1,12 @@
1
+ export declare enum PermissionType {
2
+ VIEW_GROUPS = "VIEW_GROUPS",
3
+ CREATE_ROOT_GROUP = "CREATE_ROOT_GROUP",
4
+ CREATE_SUBGROUP = "CREATE_SUBGROUP",
5
+ EDIT_GROUP = "EDIT_GROUP",
6
+ DELETE_GROUP = "DELETE_GROUP",
7
+ MANAGE_SYSTEM_USERS = "MANAGE_SYSTEM_USERS",
8
+ VIEW_GROUP_OFFICERS = "VIEW_GROUP_OFFICERS",
9
+ MANAGE_GROUP_OFFICERS = "MANAGE_GROUP_OFFICERS",
10
+ VIEW_GROUP_MEMBERS = "VIEW_GROUP_MEMBERS",
11
+ MANAGE_GROUP_MEMBERS = "MANAGE_GROUP_MEMBERS"
12
+ }
@@ -0,0 +1,8 @@
1
+ import { GroupPermission } from '../models/group-permissions.model';
2
+ import * as i0 from "@angular/core";
3
+ export declare class GroupPermissionsMapService {
4
+ groupPermissions: GroupPermission[];
5
+ getGroupPermissions(): GroupPermission[];
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<GroupPermissionsMapService, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<GroupPermissionsMapService>;
8
+ }
@@ -1,6 +1,6 @@
1
1
  import { Observable, BehaviorSubject } from 'rxjs';
2
2
  import { CreateGroupPayload, CreateGroupResponse } from '../models/create-group.model';
3
- import { GroupTypeConfiguration, GroupTypeConfigValue, GroupTypeResponse } from '../models/group-types.model';
3
+ import { BusinessRule, GroupTypeConfiguration, GroupTypeConfigValue, GroupTypeResponse } from '../models/group-types.model';
4
4
  import { AlertsService, HttpService } from '@ieeesa-npm/utility';
5
5
  import { GetGroupResponse, GetGroupsPayload } from '../models/view-group.model';
6
6
  import { DeleteGroupPayload } from '../models/delete-group.model';
@@ -14,6 +14,9 @@ import { GroupUserInfo } from '../models/group-user-info.model';
14
14
  import { AddOrEditUserPayload, AddOrEditGroupUserDetailsResponse } from '../models/add-or-edit-user-group.model';
15
15
  import { DeleteUserGroupPayload } from '../models/delete-user-group.model';
16
16
  import { GetUserDetailsPayload, SearchUserByEmailResponse } from '../models/add-new-user.model';
17
+ import { GroupPermission } from '../models/group-permissions.model';
18
+ import { PermissionType } from '../models/permission-type.model';
19
+ import { UserPermissionsService } from './user-permissions.service';
17
20
  import * as i0 from "@angular/core";
18
21
  /**
19
22
  * Groups service is an abstract layer and responsible for managing groups REST API calls.
@@ -21,6 +24,7 @@ import * as i0 from "@angular/core";
21
24
  */
22
25
  export declare class GroupsService {
23
26
  private httpService;
27
+ private userPermissionsService;
24
28
  alertService: AlertsService;
25
29
  groupsText: {
26
30
  ER1000: string;
@@ -29,17 +33,17 @@ export declare class GroupsService {
29
33
  "1003": string;
30
34
  "1004": string;
31
35
  "1005": string;
32
- "1006": string;
36
+ "1006": string; /**
37
+ * Updates group form data to server using HttpService.
38
+ * @param {EditGroupPayload} editGroupPayload -edit group form data which includes group name, short name, scope.
39
+ * @return {Observable<EditGroupPayload>} -returns edit group API response (success or error) as an observable.
40
+ * @memberof GroupsService
41
+ */
33
42
  "1007": string;
34
43
  "1008": string;
35
44
  "1009": string;
36
45
  "1010": string;
37
- "1011": string; /**
38
- * This method will parse the error codes and return the respective error message for each code.
39
- * @param {string[]} errorCodes
40
- * @return {string[]} errorMessage
41
- * @memberof GroupsService
42
- */
46
+ "1011": string;
43
47
  "1012": string;
44
48
  "1013": string;
45
49
  "1014": string;
@@ -53,7 +57,12 @@ export declare class GroupsService {
53
57
  "1022": string;
54
58
  "1023": string;
55
59
  "1024": string;
56
- "1025": string;
60
+ "1025": string; /**
61
+ * Sets selected group info.
62
+ * @param {(GroupInfo | undefined)} selectedGroupInfo -selected group info.
63
+ * @param {(GroupInfo | undefined)} [selectedGroupParentInfo] -selected parent group info.
64
+ * @memberof GroupsService
65
+ */
57
66
  "1026": string;
58
67
  "1027": string;
59
68
  "1028": string;
@@ -61,8 +70,14 @@ export declare class GroupsService {
61
70
  "1030": string;
62
71
  "1031": string;
63
72
  "1032": string;
73
+ "1033": string;
74
+ "1034": string;
64
75
  "2001": string;
65
- "2002": string;
76
+ "2002": string; /**
77
+ * Returns the selected group info.
78
+ * @return {(GroupInfo | undefined)} -group info.
79
+ * @memberof GroupsService
80
+ */
66
81
  "2010": string;
67
82
  "2011": string;
68
83
  };
@@ -76,7 +91,9 @@ export declare class GroupsService {
76
91
  selectedUserInfo: GroupUserInfo;
77
92
  canShowMessage: boolean;
78
93
  rosterFunctionType: RosterFunctionType;
79
- constructor(httpService: HttpService, alertService: AlertsService);
94
+ userGroupPermissions: GroupPermission[];
95
+ groupTypes: GroupTypeConfiguration[];
96
+ constructor(httpService: HttpService, userPermissionsService: UserPermissionsService, alertService: AlertsService);
80
97
  setAppConfig(apiBaseUrl: string, userPermission: any): void;
81
98
  /**
82
99
  * Gets application group types from API and returns it as an observable.
@@ -264,6 +281,50 @@ export declare class GroupsService {
264
281
  * @memberof GroupsService
265
282
  */
266
283
  getRosterFunctionType(): RosterFunctionType;
284
+ /**
285
+ * Gets the groups based on the search by group name or acronym.
286
+ * @param {string} searchTerm
287
+ * @return {Observable<GetGroupUsersResponse>}
288
+ * @memberof GroupsService
289
+ */
290
+ groupsByNameAcronym(searchTerm: string): Observable<GetGroupResponse>;
291
+ /**
292
+ * Sets the user group permissions
293
+ * @param {GroupPermission[]} userGroupPermissions
294
+ * @memberof GroupsService
295
+ */
296
+ setUserGroupPermissions(userGroupPermissions: GroupPermission[]): void;
297
+ /**
298
+ * Returns the user group permissions
299
+ * @return {GroupPermission[]}
300
+ * @memberof GroupsService
301
+ */
302
+ getUserGroupPermissions(): GroupPermission[];
303
+ /**
304
+ * Validates permission based access for provided feature.
305
+ * @param {PermissionType} permissionType
306
+ * @return {boolean}
307
+ * @memberof GroupsService
308
+ */
309
+ validateAccess(permissionType: PermissionType): boolean;
310
+ /**
311
+ * Store the loaded group types.
312
+ * @param {GroupTypeConfiguration[]} groupTypes
313
+ * @memberof GroupsService
314
+ */
315
+ setLoadedGroupTypes(groupTypes: GroupTypeConfiguration[]): void;
316
+ /**
317
+ * Return the loaded group types.
318
+ * @return {GroupTypeConfiguration[]}
319
+ * @memberof GroupsService
320
+ */
321
+ getLoadedGroupTypes(): GroupTypeConfiguration[];
322
+ /**
323
+ * Returns the group type configuration Business rule for the selected group.
324
+ * @return {(BusinessRule | undefined)}
325
+ * @memberof GroupsService
326
+ */
327
+ getBusinessRuleOfSelectedGroup(): BusinessRule | undefined;
267
328
  static ɵfac: i0.ɵɵFactoryDeclaration<GroupsService, never>;
268
329
  static ɵprov: i0.ɵɵInjectableDeclaration<GroupsService>;
269
330
  }
@@ -0,0 +1,25 @@
1
+ import { PermissionType } from '../models/permission-type.model';
2
+ import { GroupPermissionsMapService } from './group-permissions-map-service';
3
+ import { GroupPermission, UserPermission } from '../models/group-permissions.model';
4
+ import * as i0 from "@angular/core";
5
+ export declare class UserPermissionsService {
6
+ private groupPermissionsService;
7
+ constructor(groupPermissionsService: GroupPermissionsMapService);
8
+ /**
9
+ * Returns access provision for the passed action/feature based on whether the signed in user has appropriate permission.
10
+ * @param {PermissionType} permission
11
+ * @param {GroupPermission[]} userGroupPermissions
12
+ * @return {boolean}
13
+ * @memberof UserPermissionsService
14
+ */
15
+ validateAccessPermission(permission: PermissionType, userGroupPermissions: GroupPermission[]): boolean;
16
+ /**
17
+ * Filters signed in user group permissions from entire group permissions.
18
+ * @param {UserPermissions[]} userPermissions
19
+ * @return {GroupPermissions[]}
20
+ * @memberof UserPermissionsService
21
+ */
22
+ filterUserGroupPermissions(userPermissions: UserPermission[]): GroupPermission[];
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserPermissionsService, never>;
24
+ static ɵprov: i0.ɵɵInjectableDeclaration<UserPermissionsService>;
25
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ieeesa-npm/groups",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.1.0",
6
6
  "@angular/core": "^16.1.0",
7
- "@ieeesa-npm/presentation": "^0.8.2",
8
- "@ieeesa-npm/shared-styles": "^0.1.9",
9
- "@ieeesa-npm/utility": "^0.7.5"
7
+ "@ieeesa-npm/presentation": "^0.8.7",
8
+ "@ieeesa-npm/shared-styles": "^0.2.1",
9
+ "@ieeesa-npm/utility": "^0.7.9"
10
10
  },
11
11
  "dependencies": {
12
12
  "tslib": "^2.3.0"