1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-21 16:18:28 +01:00

Fix groups modal not loading if admin access restricted (#9182)

This commit is contained in:
Thomas Rittson 2024-05-15 10:59:59 +10:00 committed by GitHub
parent 6ab7336c21
commit 0812f00d24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -273,12 +273,13 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
// If the current user is not already in the group and cannot add themselves, remove them from the list
if (restrictGroupAccess) {
const organizationUserId = this.members.find((m) => m.userId === activeAccount.id).id;
// organizationUserId may be null if accessing via a provider
const organizationUserId = this.members.find((m) => m.userId === activeAccount.id)?.id;
const isAlreadyInGroup = this.groupForm.value.members.some(
(m) => m.id === organizationUserId,
);
if (!isAlreadyInGroup) {
if (organizationUserId != null && !isAlreadyInGroup) {
this.members = this.members.filter((m) => m.id !== organizationUserId);
}
}