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 /routers/api | |
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 'routers/api')
-rw-r--r-- | routers/api/v1/repo/release.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go index 6438c6e9b4..a600a1e33f 100644 --- a/routers/api/v1/repo/release.go +++ b/routers/api/v1/repo/release.go @@ -114,7 +114,7 @@ func ListReleases(ctx *context.APIContext) { opts := models.FindReleasesOptions{ ListOptions: listOptions, - IncludeDrafts: ctx.Repo.AccessMode >= models.AccessModeWrite, + IncludeDrafts: ctx.Repo.AccessMode >= models.AccessModeWrite || ctx.Repo.UnitAccessMode(models.UnitTypeReleases) >= models.AccessModeWrite, IncludeTags: false, IsDraft: ctx.FormOptionalBool("draft"), IsPreRelease: ctx.FormOptionalBool("pre-release"), |