Skip to content

feat: Add assignment for org role associations #3371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions github/github-stringify_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions github/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ type Team struct {
// Permission specifies the default permission for repositories owned by the team.
Permission *string `json:"permission,omitempty"`

// Permissions identifies the permissions that a team has on a given
// repository. This is only populated when calling Repositories.ListTeams.
Permissions map[string]bool `json:"permissions,omitempty"`

// Privacy identifies the level of privacy this team should have.
// Possible values are:
// secret - only visible to organization owners and members of this team
Expand All @@ -52,6 +48,15 @@ type Team struct {
// LDAPDN is only available in GitHub Enterprise and when the team
// membership is synchronized with LDAP.
LDAPDN *string `json:"ldap_dn,omitempty"`

// Permissions identifies the permissions that a team has on a given
// repository. This is only populated when calling Repositories.ListTeams.
Permissions map[string]bool `json:"permissions,omitempty"`

// Assignment identifies how a team was assigned to an organization role. Its
// possible values are: "direct", "indirect", "mixed". This is only populated when
// calling the ListTeamsAssignedToOrgRole method.
Assignment *string `json:"assignment,omitempty"`
}

func (t Team) String() string {
Expand Down
8 changes: 8 additions & 0 deletions github/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ type User struct {
// repository. These are only populated when calling Repositories.ListCollaborators.
Permissions map[string]bool `json:"permissions,omitempty"`
RoleName *string `json:"role_name,omitempty"`

// Assignment identifies how a user was assigned to an organization role. Its
// possible values are: "direct", "indirect", "mixed". This is only populated when
// calling the ListUsersAssignedToOrgRole method.
Assignment *string `json:"assignment,omitempty"`
// InheritedFrom identifies the team that a user inherited their organization role
// from. This is only populated when calling the ListUsersAssignedToOrgRole method.
InheritedFrom *Team `json:"inherited_from,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevehipwell the inherited_from field returns for me as an array which fails the unmarshalling, are you sure you got only a single team in the API result?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the schema might have changed as it's now looks like an array, but I'm pretty sure I tested this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to change this field to an array can you verify it doesn't break anything for you? I want to know if we need to support both cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevehipwell I opened this: #3460

}

func (u User) String() string {
Expand Down
Loading