Skip to content

Implemented New Method to Retrieve all Collaborators from a Repository#98

Closed
luciano-sabenca-movile wants to merge 2 commits into
hub4j:masterfrom
luciano-sabenca-movile:master
Closed

Implemented New Method to Retrieve all Collaborators from a Repository#98
luciano-sabenca-movile wants to merge 2 commits into
hub4j:masterfrom
luciano-sabenca-movile:master

Conversation

@luciano-sabenca-movile
Copy link
Copy Markdown

Hi.

I have a very ordinary use-case: I need to check if a Github user has access to a repository. Unfortunately, the Github's API doesn't provide a way to do it directly. To do it, I need to get all repos and check in which repositories the user is in repository's collaborators list. I tried to implement it, but a found a little problem: the method getCollaborators just return the first 30th collaborators. So, I've implemented a new method to retrieve all collaborators from a repository doing pagination just like several other methods from this library.

There is also, in this pull-request, fixes to some formatting issues and a unitary test-case to the new method.

Any question/suggestion, please, feel free to contact me.

Thanks in advance

@buildhive
Copy link
Copy Markdown

Kohsuke Kawaguchi » github-api #195 SUCCESS
This pull request looks good
(what's this?)

@suryagaddipati
Copy link
Copy Markdown
Collaborator

Just curious. Why not use GHUser.getRepositories() get users orgs GHUser.getMyOrganizations and GHOrganization.getRepositories() and check GHRepository.hasPushAccess and GHRepository.hasAdminAccess

@luciano-sabenca-movile
Copy link
Copy Markdown
Author

Yes, I think that this is a solution to my use-case too. There isn't any particular reason to justify why I didn't use this solution, probably it will work fine too. I just thought the other solution as "more natural" or something like that :) .

Anyway, I think that this pull-request is still valid, at least to fix this "bug"(I don't know if this is really a bug or just a design decision, in my opinion, it is more likely to be a bug, or, at least, a non-documented behavior).

@suryagaddipati
Copy link
Copy Markdown
Collaborator

@luciano-sabenca-movile sorry for the late response. I will review this over the weekend. Thank you.

kohsuke added a commit that referenced this pull request Jul 3, 2014
The original commit has too many whitespace noise changes.

Reference: #98
@kohsuke
Copy link
Copy Markdown
Collaborator

kohsuke commented Jul 3, 2014

Unforunately your change has too many whitespace changes, presumably caused by your IDE.

I recommend you disable auto-reformatting in IDE when you work on patches. I've extracted the code change in ba519f9, so this PR is effectively merged.

@kohsuke kohsuke closed this Jul 3, 2014
@luciano-sabenca-movile
Copy link
Copy Markdown
Author

Ok! In fact, it was caused by the IDE.
No problem at all.
Thanks

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.

4 participants