diff options
author | zeripath <art27@cantab.net> | 2021-10-28 03:54:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 10:54:40 +0800 |
commit | 0b4a8be26bf9c2941f62ba9444ae9a60d432f0a9 (patch) | |
tree | 6e62b0cd462515163850316bee0910a4b99bd040 /modules | |
parent | 2b2eb5d0ad0a632573da762a151ddae23c5b2e4a (diff) | |
download | gitea-0b4a8be26bf9c2941f62ba9444ae9a60d432f0a9.tar.gz gitea-0b4a8be26bf9c2941f62ba9444ae9a60d432f0a9.zip |
Ensure that restricted users can access repos for which they are members (#17460)
There is a small bug in the way that repo access is checked in
repoAssignment: Accessibility is checked by checking if the user has a
marked access to the repository instead of checking if the user has any
team granted access.
This PR changes this permissions check to use HasAccess() which does the
correct test. There is also a fix in the release api ListReleases where
it should return draft releases if the user is a member of a team with
write access to the releases.
The PR also adds a testcase.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/context/repo.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index 8972cd28bc..88f4d27658 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -345,7 +345,7 @@ func repoAssignment(ctx *Context, repo *models.Repository) { } // Check access. - if ctx.Repo.Permission.AccessMode == models.AccessModeNone { + if !ctx.Repo.Permission.HasAccess() { if ctx.FormString("go-get") == "1" { EarlyResponseForGoGetMeta(ctx) return |