Pygithub: Add method to set permission level of team collaborator on Organization repository

Created on 28 Jul 2017  路  5Comments  路  Source: PyGithub/PyGithub

There is currently no method in PyGithub to set the permission level of a team collaborator on a repository.

At a minimum, the method github.Team.Team.add_to_repos should take an optional parameter permission=str to set the permission level of a collaborator. The current default appears to be push.

Based on the GitHub API, reusing the same method to update repo permissions would be correct.

Relevent API reference: https://developer.github.com/v3/orgs/teams/#add-or-update-team-repository

Most helpful comment

There does appear to be an undocumented Team.set_repo_permission method which does the same thing as add_to_repos, but with the permission parameter set.

All 5 comments

There does appear to be an undocumented Team.set_repo_permission method which does the same thing as add_to_repos, but with the permission parameter set.

Sounds like this issue could be resolved by documentation improvement then. For API consistency with REST, updating add_to_repos seems optimal. As a user, I would expect to have to call both Team.set_repo_permission and Team.add_to_repos without looking at the underlying implementation.

Thanks, using set_repo_permission instead of add_to_repos indeed does the job!

Why is this not documented? :(
It has a docstring and seems to be there for at least one year?

// edit, well, maybe because the documentation is old?
http://pygithub.readthedocs.io/en/latest/changes.html

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This seems to be available in the latest documentation.

Was this page helpful?
0 / 5 - 0 ratings