fix: Missing permission on selector in permissions dialog

This commit is contained in:
Tom Moor
2023-12-27 12:41:53 -05:00
parent 548a56e058
commit e7fbec91fc
5 changed files with 31 additions and 7 deletions

View File

@@ -87,4 +87,16 @@ export default class CollectionGroupMembershipsStore extends Store<CollectionGro
}
});
};
/**
* Find a collection group membership by collectionId and groupId
*
* @param collectionId The collection ID
* @param groupId The group ID
* @returns The collection group membership or undefined if not found.
*/
find = (collectionId: string, groupId: string) =>
Array.from(this.data.values()).find(
(m) => m.groupId === groupId && m.collectionId === collectionId
);
}

View File

@@ -91,11 +91,21 @@ export default class MembershipsStore extends Store<Membership> {
collectionId: string;
userId: string;
}) => {
const membership = Array.from(this.data.values()).find(
(m) => m.userId === userId && m.collectionId === collectionId
);
const membership = this.find(collectionId, userId);
if (membership) {
this.remove(membership.id);
}
};
/**
* Find a collection user membership by collectionId and userId
*
* @param collectionId The collection ID
* @param userId The user ID
* @returns The collection user membership or undefined if not found.
*/
find = (collectionId: string, userId: string) =>
Array.from(this.data.values()).find(
(m) => m.userId === userId && m.collectionId === collectionId
);
}