Closed
Description
- Gitea version (or commit ref): 1.9.4 built with GNU Make 4.1, go1.12.10 : bindata, sqlite, sqlite_unlock_notify
- Git version: 2.20.1
- Operating system: Debian Buster
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (see below)
- No
- Not relevant
Description
The API only returns private repos if you are the owner or administrator regardless if you have read access. This issue occurred a while ago with organizations too, but this was fixed. The problem remains for private user repos.
##Example:
How to reproduce:
- Create User A
- Create User B (non-admin)
- Let User A create a private repository
- Add User B as collaborator with read permission
- Use user api: https://try.gitea.io/api/v1/users/userA_api_bug/repos
while beeing logged in as User B
Expected: Show private repo of User A because User B has read access
User B request via token:
curl -X GET "https://try.gitea.io/api/v1/users/userA_api_bug/repos" -H "accept: application/json" -H "authorization: token c96aed5997df331c976fc935e49cede48a96ff9f"
Expected same output as with user A via token:
curl -s -X GET "https://try.gitea.io/api/v1/users/userA_api_bug/repos" -H "accept: application/json" -H "authorization: token d459b6f9ceffa93af7a8cdfb36e82fe3d8f68b94"