You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ho...@apache.org on 2026/08/14 07:28:04 UTC
(streampipes) branch 4814-fix-user-and-group-selection-in-manage-permissions-dialog updated: group
This is an automated email from the ASF dual-hosted git repository.
JHoelli pushed a commit to branch 4814-fix-user-and-group-selection-in-manage-permissions-dialog
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/4814-fix-user-and-group-selection-in-manage-permissions-dialog by this push:
new cb5754acb7 group
cb5754acb7 is described below
commit cb5754acb76ed398817bd2bc0129d4a492fc2438
Author: Jacqueline Höllig <j....@gmx.net>
AuthorDate: Fri Aug 14 07:27:29 2026 +0000
group
---
.../object-manage-dialog.component.ts | 50 ++++++++++++++++++----
.../object-permission-dialog.component.ts | 48 +++++++++++++++++----
2 files changed, 82 insertions(+), 16 deletions(-)
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/object-manage-dialog/object-manage-dialog.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/object-manage-dialog/object-manage-dialog.component.ts
index 9f2e97be27..d418c7b6b4 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/object-manage-dialog/object-manage-dialog.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/object-manage-dialog/object-manage-dialog.component.ts
@@ -290,8 +290,12 @@ export class ObjectManageDialogComponent<
),
).subscribe(
results => {
- this.allUsers = results[0];
- this.allGroups = results[1];
+ this.allUsers = results[0].filter(user =>
+ this.isSelectableUser(user),
+ );
+ this.allGroups = results[1].filter(group =>
+ this.isSelectableGroup(group),
+ );
this.processPermissions(results[2]);
this.permissionDenied = false;
this.loading = false;
@@ -409,26 +413,40 @@ export class ObjectManageDialogComponent<
}
get availableUsers(): ShortUserInfo[] {
- return this.allUsers?.filter(u => !this.isOwnerOrAdded(u)) ?? [];
+ return (
+ this.allUsers?.filter(
+ user =>
+ this.isSelectableUser(user) && !this.isOwnerOrAdded(user),
+ ) ?? []
+ );
}
get availableGroups(): Group[] {
- return this.allGroups?.filter(g => !this.isGroupAdded(g)) ?? [];
+ return (
+ this.allGroups?.filter(
+ group =>
+ this.isSelectableGroup(group) && !this.isGroupAdded(group),
+ ) ?? []
+ );
}
onGrantedUsersChange(
users: ShortUserInfo | ShortUserInfo[] | undefined,
): void {
- this.grantedUserAuthorities = Array.isArray(users) ? users : [];
+ this.grantedUserAuthorities = Array.isArray(users)
+ ? users.filter(user => this.isSelectableUser(user))
+ : [];
}
onGrantedGroupsChange(groups: Group | Group[] | undefined): void {
- this.grantedGroupAuthorities = Array.isArray(groups) ? groups : [];
+ this.grantedGroupAuthorities = Array.isArray(groups)
+ ? groups.filter(group => this.isSelectableGroup(group))
+ : [];
}
private addUserToSelection(authority: PermissionEntry) {
const user = this.allUsers.find(u => u.principalId === authority.sid);
- if (user !== undefined) {
+ if (user !== undefined && this.isSelectableUser(user)) {
this.grantedUserAuthorities.push(user);
}
}
@@ -695,7 +713,21 @@ export class ObjectManageDialogComponent<
private addGroupToSelection(authority: PermissionEntry) {
const group = this.allGroups.find(u => u.groupId === authority.sid);
- this.grantedGroupAuthorities.push(group);
+ if (group !== undefined && this.isSelectableGroup(group)) {
+ this.grantedGroupAuthorities.push(group);
+ }
+ }
+
+ private isSelectableUser(user: ShortUserInfo | undefined): boolean {
+ return (
+ user !== undefined &&
+ user.principalType !== 'GROUP' &&
+ !!user.principalId
+ );
+ }
+
+ private isSelectableGroup(group: Group | undefined): boolean {
+ return group !== undefined && !!group.groupId;
}
private _filter(value: any): ShortUserInfo[] {
@@ -705,6 +737,7 @@ export class ObjectManageDialogComponent<
: value.toLowerCase();
return this.allUsers.filter(u => {
return (
+ this.isSelectableUser(u) &&
u.email.toLowerCase().startsWith(filterValue) &&
!this.isOwnerOrAdded(u)
);
@@ -718,6 +751,7 @@ export class ObjectManageDialogComponent<
: value.toLowerCase();
return this.allGroups.filter(g => {
return (
+ this.isSelectableGroup(g) &&
g.groupName.toLowerCase().startsWith(filterValue) &&
!this.isGroupAdded(g)
);
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/object-permission-dialog/object-permission-dialog.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/object-permission-dialog/object-permission-dialog.component.ts
index 119a9d83d9..6b041d0266 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/object-permission-dialog/object-permission-dialog.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/object-permission-dialog/object-permission-dialog.component.ts
@@ -133,8 +133,12 @@ export class ObjectPermissionDialogComponent implements OnInit {
),
).subscribe(
results => {
- this.allUsers = results[0];
- this.allGroups = results[1];
+ this.allUsers = results[0].filter(user =>
+ this.isSelectableUser(user),
+ );
+ this.allGroups = results[1].filter(group =>
+ this.isSelectableGroup(group),
+ );
this.processPermissions(results[2]);
this.permissionDenied = false;
this.loading = false;
@@ -219,33 +223,61 @@ export class ObjectPermissionDialogComponent implements OnInit {
}
get availableUsers(): ShortUserInfo[] {
- return this.allUsers?.filter(u => !this.isOwnerOrAdded(u)) ?? [];
+ return (
+ this.allUsers?.filter(
+ user =>
+ this.isSelectableUser(user) && !this.isOwnerOrAdded(user),
+ ) ?? []
+ );
}
get availableGroups(): Group[] {
- return this.allGroups?.filter(g => !this.isGroupAdded(g)) ?? [];
+ return (
+ this.allGroups?.filter(
+ group =>
+ this.isSelectableGroup(group) && !this.isGroupAdded(group),
+ ) ?? []
+ );
}
onGrantedUsersChange(
users: ShortUserInfo | ShortUserInfo[] | undefined,
): void {
- this.grantedUserAuthorities = Array.isArray(users) ? users : [];
+ this.grantedUserAuthorities = Array.isArray(users)
+ ? users.filter(user => this.isSelectableUser(user))
+ : [];
}
onGrantedGroupsChange(groups: Group | Group[] | undefined): void {
- this.grantedGroupAuthorities = Array.isArray(groups) ? groups : [];
+ this.grantedGroupAuthorities = Array.isArray(groups)
+ ? groups.filter(group => this.isSelectableGroup(group))
+ : [];
}
private addUserToSelection(authority: PermissionEntry) {
const user = this.allUsers.find(u => u.principalId === authority.sid);
- if (user !== undefined) {
+ if (user !== undefined && this.isSelectableUser(user)) {
this.grantedUserAuthorities.push(user);
}
}
private addGroupToSelection(authority: PermissionEntry) {
const group = this.allGroups.find(u => u.groupId === authority.sid);
- this.grantedGroupAuthorities.push(group);
+ if (group !== undefined && this.isSelectableGroup(group)) {
+ this.grantedGroupAuthorities.push(group);
+ }
+ }
+
+ private isSelectableUser(user: ShortUserInfo | undefined): boolean {
+ return (
+ user !== undefined &&
+ user.principalType !== 'GROUP' &&
+ !!user.principalId
+ );
+ }
+
+ private isSelectableGroup(group: Group | undefined): boolean {
+ return group !== undefined && !!group.groupId;
}
private isOwnerOrAdded(user: ShortUserInfo): boolean {