mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-08 03:29:43 +02:00
Check for access in /repositories/:id (#2227)
* Check for access in /repositories/:id * Integration test
This commit is contained in:
1 parent
a9cc538ab5
commit
49df677c47
2 files changed
+12
-1
No files matched your search
@@ -293,7 +293,10 @@ func GetByID(ctx *context.APIContext) {
|
||||
|
||||
access, err := models.AccessLevel(ctx.User.ID, repo)
|
||||
if err != nil {
|
||||
ctx.Error(500, "GetRepositoryByID", err)
|
||||
ctx.Error(500, "AccessLevel", err)
|
||||
return
|
||||
} else if access < models.AccessModeRead {
|
||||
ctx.Status(404)
|
||||
return
|
||||
}
|
||||
ctx.JSON(200, repo.APIFormat(access))
|
||||
|
||||
Reference in new issue
Block a user