def delete_group_member(request, group_id, member_id): group = db.get_group(request.db_session, id=group_id) if group is None: raise Exception("Group does not exit.") if group.owner.id == member_id: raise Exception("Cannot remove group owner from the group!") db.delete_group_to_user(request.db_session, group_id=group_id, user_id=member_id) return
def is_user_authorized_to_update_group(request, username, group_id): is_authorized = False group = db.get_group(request.db_session, group_id) if group is not None: # Graph exists if group.owner_email == username: is_authorized = True return is_authorized
def is_user_authorized_to_view_group(request, username, group_id): is_authorized = False group = db.get_group(request.db_session, group_id) if group is not None: # Graph exists if group.owner_email == username: is_authorized = True elif is_member_of_group(request, username, group_id): # graph is public is_authorized = True return is_authorized
def get_group_by_id(request, group_id): return db.get_group(request.db_session, id=group_id)