8000 Teams.IsTeamRepoByID support for custom roles · Issue #2378 · google/go-github · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Teams.IsTeamRepoByID support for custom roles #2378
Closed
@joshua-hancox

Description

@joshua-hancox

Now that GitHub has created the custom roles feature, I think the implementation of Teams.IsTeamRepoByID (and BySlug) may need to be changed, or a new function added.

https://github.com/google/go-github/blob/master/github/teams.go#L411L427

Currently, we return a repository object, which contains information about which permissions the specified team has on the repository.

e.g.

    "permissions": {
        "admin": true,
        "maintain": true,
        "push": true,
        "triage": true,
        "pull": true
    }

However, the API that we interact with here also returns the name of the role that is assigned to that team on that repository.

e.g

    "role_name": "admin"

Previously this was not an issue, as it was possible to work out what the role name would be based on the permissions object. (since all role names are included there.) Now that custom roles are available, a role based on the admin role may be created, but with a custom name.

e.g.

    "permissions": {
        "admin": true,
        "maintain": true,
        "push": true,
        "triage": true,
        "pull": true
    }
    "role_name": "super-admin"

Based on what is returned from this function currently, we cannot get the name of the role, and the permissions object looks identical to the one returned when the built-in admin role is assigned.

Should we extend the Repository type to include the role_name? It seems a bit strange to me that the permissions object is included there since that describes an assignment between a team and a repo rather than just an attribute of the repo. But if we wanted to follow that pattern would the change to include role_name make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0