Can we check the authenticated user have permission to the installed repository?


#1

In my github apps, it need to check the authenticated user have permission to access specified repository.
However,
Installations API only provides List repositories, and cannot check one repository.
If the users install tons of repositories to my app, it’s not ideal to list all repositories and find one specified repo from the list.

https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation

Can you please add an API to check one repository???
I needed to changed the GitHub app permission to request “Repository contents” scope, but ideally my app won’t need this scope and want to remove it.

Thanks in advance.


#2

Oh, Repository contents permission also cannot be used.

Looks like it’s for https://developer.github.com/v3/repos/contents/#get-contents.

Which permission should i request for Get repo API?
https://developer.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#repos


#3

Sorry, never mind. I found I need metadata permission. https://developer.github.com/v3/apps/permissions/#metadata-permissions


#4

Yes, exactly - and metadata permissions are enabled for every app.

For anyone else coming to this discussion, the endpoint you want to check out is https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level.

:slight_smile:


#5

Thank you for the answer!