diff --git a/aleksis/core/util/predicates.py b/aleksis/core/util/predicates.py index 0e452ddb0cb560ba4edbe174c560ade56c6261ed..975273d7d934ae41df8ecefb494b121ed69b2a94 100644 --- a/aleksis/core/util/predicates.py +++ b/aleksis/core/util/predicates.py @@ -98,6 +98,12 @@ def is_group_owner(user: User, group: Group) -> bool: return group.owners.filter(owners=user.person).exists() +@predicate +def is_group_member(user: User, group: Group) -> bool: + """Predicate which checks if the user is a member of the provided group.""" + return user.person in group.members.all() + + @predicate def is_notification_recipient(user: User, obj: Model) -> bool: """Check if is a notification recipient.