def groups(user):
    """
    Returns all groups the user is a member of.
    :param user: the logged-in user
    :return: Array of groups
    """
    try:
        my_groups = user.groups.all()
        return my_groups
    except Exception as e:
        print(e)