Beispiel #1
0
 def user_has_perm(self, user, topic):
     if user.is_superuser or user.is_staff:
         return True
     # If the user is a coordinator of any of the teams that are active
     # participants, allow them to remove a participating team.
     teams = set(p.content for p in topic.participants_of_type(Team).filter(is_active=True))
     return any(iscoordinatorofteam(user, team) for team in teams)
Beispiel #2
0
def event_edit(request, event):
    group = request.group
    user = request.user
    if user.is_staff:
        return True
    if iscoordinatorofteam(user, group):
        return True
    if getattr(group, 'is_private', False) and group.user_is_member(user):
        return True
    return False
Beispiel #3
0
 def has_permission_for_group(group):
     return user_obj.is_staff or (
         # Page has a group associated.
         group is not None
         and (
             # User is coordinator of the group, or
             iscoordinatorofteam(user_obj, group)
             or (
                 # User is member and either the group is private
                 # or the user has been a member for more than 4 days.
                 group.user_is_member(user_obj)
                 and (
                     group.is_private
                     or (user_obj.date_joined < datetime.datetime.now() - datetime.timedelta(days=4))
                 )
             )
         )
     )