-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: Implement organization role assignments for both users and teams #3281
base: master
Are you sure you want to change the base?
Conversation
While working on this I noticed that the file naming is slightly off from how GitHub structures their API:s. There's a difference between repository roles and organization roles, but currently the Leaving it up to the reviewer to decide if this should be done in this PR directly or in a separate one later |
Please perform the reorganization in your next PR. Thank you! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3281 +/- ##
==========================================
- Coverage 97.72% 92.96% -4.76%
==========================================
Files 153 171 +18
Lines 13390 11705 -1685
==========================================
- Hits 13085 10882 -2203
- Misses 215 729 +514
- Partials 90 94 +4 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @felixlut !
Just a few minor tweaks, please, then we should be ready for a second LGTM+Approval from any other contributor to this repo.
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-team | ||
// | ||
//meta:operation PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id} | ||
func (s *OrganizationsService) AssignOrgRoleToTeam(ctx context.Context, org string, teamSlug string, roleID int64) (*Response, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (s *OrganizationsService) AssignOrgRoleToTeam(ctx context.Context, org string, teamSlug string, roleID int64) (*Response, error) { | |
func (s *OrganizationsService) AssignOrgRoleToTeam(ctx context.Context, org, teamSlug string, roleID int64) (*Response, error) { |
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-team | ||
// | ||
//meta:operation DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id} | ||
func (s *OrganizationsService) RemoveOrgRoleFromTeam(ctx context.Context, org string, teamSlug string, roleID int64) (*Response, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (s *OrganizationsService) RemoveOrgRoleFromTeam(ctx context.Context, org string, teamSlug string, roleID int64) (*Response, error) { | |
func (s *OrganizationsService) RemoveOrgRoleFromTeam(ctx context.Context, org, teamSlug string, roleID int64) (*Response, error) { |
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-user | ||
// | ||
//meta:operation PUT /orgs/{org}/organization-roles/users/{username}/{role_id} | ||
func (s *OrganizationsService) AssignOrgRoleToUser(ctx context.Context, org string, username string, roleID int64) (*Response, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (s *OrganizationsService) AssignOrgRoleToUser(ctx context.Context, org string, username string, roleID int64) (*Response, error) { | |
func (s *OrganizationsService) AssignOrgRoleToUser(ctx context.Context, org, username string, roleID int64) (*Response, error) { |
return resp, nil | ||
} | ||
|
||
// RemoveOrgRoleFromUser removes an existing organization role assignment to a user in this organization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// RemoveOrgRoleFromUser removes an existing organization role assignment to a user in this organization. | |
// RemoveOrgRoleFromUser removes an existing organization role assignment from a user in this organization. |
return resp, nil | ||
} | ||
|
||
// RemoveOrgRoleFromTeam removes an existing organization role assignment to a team in this organization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// RemoveOrgRoleFromTeam removes an existing organization role assignment to a team in this organization. | |
// RemoveOrgRoleFromTeam removes an existing organization role assignment from a team in this organization. |
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-user | ||
// | ||
//meta:operation DELETE /orgs/{org}/organization-roles/users/{username}/{role_id} | ||
func (s *OrganizationsService) RemoveOrgRoleFromUser(ctx context.Context, org string, username string, roleID int64) (*Response, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (s *OrganizationsService) RemoveOrgRoleFromUser(ctx context.Context, org string, username string, roleID int64) (*Response, error) { | |
func (s *OrganizationsService) RemoveOrgRoleFromUser(ctx context.Context, org, username string, roleID int64) (*Response, error) { |
resolves #3280