Skip to content
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

Add member role filter to OrganizationMembersClient.GetAll() functions #1072

Merged
merged 2 commits into from
Jan 31, 2016

Conversation

ryangribble
Copy link
Contributor

While working on implementing GitHub Enterprise APIs I came across the fact that the OrganizationMembers API implementation was missing the "Role" filter option (all, admin, member).
https://developer.github.com/v3/orgs/members/#parameters

I also added integration tests for the GetAll method (previously there were none for this whole API) and all work fine in my integration tests...

however I found that querying for Admin/Member role only returns correct results when the requester is a member of the organization. When the requester is not in the organization, the member and admin filters just return all users in the org.

I also found that with the existing "filter" attribute (2fa_disabled, all) only owners of an organization are allowed to use the 2fa_disabled filter, and octokit throws an exception if the requester is not an org owner.

Im not sure what settings you guys run the integration tests under for octokit.net so I have set the integration tests that would have triggered these conditions, to SKIP for now. If the integration tests on AppVeyor/Travis do run as an org member or org admin, let me know and I can un-skip the tests (i also need to know the name of the org to use in the queries... currently "octokit" is used).

Add unit tests
Added integration tests for this method (previously there were none)
... but then disabled the integration tests that use the filters, as they require the requester to be an org member (for role filter) or owner (for 2 factor filter)
@shiftkey
Copy link
Member

@ryangribble wow, this is great! Thanks for catching this!

Im not sure what settings you guys run the integration tests under for octokit.net so I have set the integration tests that would have triggered these conditions, to SKIP for now.

This is fine, and while I use a separate account for testing I'm not sure what might work for it around organizations. I'm aiming to prepare a new release this week, so I'll look into that (probably needs an extensibility point :sad:) while I'm preparing and testing everything...

@shiftkey
Copy link
Member

shiftkey added a commit that referenced this pull request Jan 31, 2016
Add member role filter to OrganizationMembersClient.GetAll() functions
@shiftkey shiftkey merged commit 829677c into octokit:master Jan 31, 2016
@ryangribble ryangribble deleted the add-member-role-filter branch February 1, 2016 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants