API: '/orgs/:org/repos' should also return private repos, which the caller has read access to #2511

Closed
opened 2025-11-02 04:38:57 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @inxonic on GitHub (Nov 9, 2018).

  • Gitea version (or commit ref): d487a76
  • Operating system: Linux
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (example below)

Description

API /orgs/:org/repos only returns public repos of an org (if not called as admin). I'd expect it to also return private repos, which the caller has at least read access to.

This would be more consistent with the web interface and the Github API where type defaults to all. Further there's no other API call for that purpose.

Example

Only returns testcase01/public-repo:
curl -X GET "https://try.gitea.io/api/v1/orgs/testcase01/repos" -H "accept: application/json" -H "authorization: Basic dGVzdHVzZXIwMjp0ZXN0dXNlcjAy"

Should also return testcase01/private-repo as it is readable:
curl -X GET "https://try.gitea.io/api/v1/repos/testcase01/private-repo" -H "accept: application/json" -H "authorization: Basic dGVzdHVzZXIwMjp0ZXN0dXNlcjAy"

Web interface also returns both repos:
curl -X GET https://try.gitea.io/testcase01 -H "accept: application/json" -H "authorization: Basic dGVzdHVzZXIwMjp0ZXN0dXNlcjAy"

Originally created by @inxonic on GitHub (Nov 9, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): d487a76 - Operating system: Linux - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (example below) ## Description API `/orgs/:org/repos` only returns public repos of an org (if not called as admin). I'd expect it to also return private repos, which the caller has at least read access to. This would be more consistent with the web interface and the [Github API](https://developer.github.com/v3/repos/#list-organization-repositories) where `type` defaults to `all`. Further there's no other API call for that purpose. ## Example Only returns `testcase01/public-repo`: `curl -X GET "https://try.gitea.io/api/v1/orgs/testcase01/repos" -H "accept: application/json" -H "authorization: Basic dGVzdHVzZXIwMjp0ZXN0dXNlcjAy"` Should also return `testcase01/private-repo` as it is readable: `curl -X GET "https://try.gitea.io/api/v1/repos/testcase01/private-repo" -H "accept: application/json" -H "authorization: Basic dGVzdHVzZXIwMjp0ZXN0dXNlcjAy"` Web interface also returns both repos: `curl -X GET https://try.gitea.io/testcase01 -H "accept: application/json" -H "authorization: Basic dGVzdHVzZXIwMjp0ZXN0dXNlcjAy"`
GiteaMirror added the type/bugmodifies/api labels 2025-11-02 04:38:57 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2511