Exemple #1
0
def get_all_group_names(db_session):
    # type: (Session) -> List[Str]
    """
    Get all existing group names from the database.
    """
    group_names = ax.evaluate_call(
        lambda: [
            grp.group_name
            for grp in GroupService.all(models.Group, db_session=db_session)
        ],
        http_error=HTTPForbidden,
        msg_on_fail=s.Groups_GET_ForbiddenResponseSchema.description)
    return group_names
Exemple #2
0
def get_discoverable_groups(db_session):
    # type: (Session) -> List[models.Group]
    """
    Get all existing group that are marked as publicly discoverable from the database.
    """
    groups = ax.evaluate_call(
        lambda: [
            grp
            for grp in GroupService.all(models.Group, db_session=db_session)
            if grp.discoverable
        ],
        http_error=HTTPForbidden,
        msg_on_fail=s.RegisterGroups_GET_ForbiddenResponseSchema.description)
    return groups