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

Users API - return incorrect information #3496

Closed
MytsYurii opened this issue Feb 26, 2025 · 4 comments
Closed

Users API - return incorrect information #3496

MytsYurii opened this issue Feb 26, 2025 · 4 comments

Comments

@MytsYurii
Copy link

Users API: orgs/%v/members - return us a list of users.
User struct has a field : SiteAdmin which is *bool.

Am I right that this should return true if the user is an enterprise Owner?

if so it do not work as expected.

also other fields such as permissions/role name - are always empty or nil.

even with admin user permissions.

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 26, 2025

According to the official documentation: https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#list-organization-members
it appears that the answer is "yes".

To debug issues like this, we typically use go-httpdebug to have go-github print out the curl equivalent of the command you are issuing to GitHub, and then manually run the curl and see if there are any fields missing.

If both curl and the ListMembers endpoint are missing the fields of interest, then you can contact GitHub Tech Support and ask why they are missing. (One answer that is sometimes returned is that the PAT (Personal Access Token) being used in the call doesn't have the correct roles or the owner of that PAT does not have permission to return the requested information.)

If, however, curl returns the desired fields but this repo's endpoint does NOT, then either the field is missing entirely or we have some other bug or issue that is preventing it from getting through.

Feel free to report back in this issue what your findings are after following the above advice. Thanks.

@MytsYurii
Copy link
Author

@gmlewis official user schema does not include roles/ permissions into response, but Go library has it.
I suppose it should be updated: https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#list-organization-members

Image

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 28, 2025

Very frequently in this repo we reuse structs for many endpoints, and I am extremely hesitant to remove fields unless we can conclusively prove that a field is not used anywhere else.

What can easily be done, and please let me know if you would like to do this, is to add a comment to the struct that it is NOT populated by the "following endpoints: ...".

@MytsYurii
Copy link
Author

didn't take into a count that it is used in other endpoints where it can be returned.

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

No branches or pull requests

2 participants