Skip to content
Snippets Groups Projects
Verified Commit 1cd97440 authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Add predicate which checks if a user is member of a provided group

parent 118d3baa
No related branches found
No related tags found
1 merge request!290Resolve "is_member_of predicate"
Pipeline #2376 passed
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment