INNER CODE UNIT · Python

list_gitlab_groups

phasehq/console · backend/api/utils/syncing/gitlab/main.py:128

def list_gitlab_groups(credential_id):
    """
    List all GitLab visible groups for the authenticated user.
    This function paginates through the GitLab API to fetch all groups accessible to the user.
    It filters access levels to groups that the user can CRUD CI/CD variables.
    """

    if not validate_auth(credential_id):
        raise Exception(
            "Could not authenticate with GitLab. Please check that your credentials are valid"
        )

    GITLAB_HOST, GITLAB_TOKEN = get_gitlab_credentials(credential_id)

    GITLAB_GROUPS_BASE_URL = (
        f"{GITLAB_HOST}/api/v4/groups?membership=true&min_access_level=30&per_page=100"
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…