diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-10 03:57:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 20:57:58 +0100 |
commit | 99b2858e628d92bba252be72def409af77af735b (patch) | |
tree | 56159cf10b271307911e6f01626c0c3efba789ab /modules/context/permission.go | |
parent | b6b1e716654fec3b16d245ef65cf42e57e1bb5b6 (diff) | |
download | gitea-99b2858e628d92bba252be72def409af77af735b.tar.gz gitea-99b2858e628d92bba252be72def409af77af735b.zip |
Move unit into models/unit/ (#17576)
* Move unit into models/unit/
* Rename unit.UnitType as unit.Type
Diffstat (limited to 'modules/context/permission.go')
-rw-r--r-- | modules/context/permission.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/context/permission.go b/modules/context/permission.go index b9cdf93de2..2b87aa4591 100644 --- a/modules/context/permission.go +++ b/modules/context/permission.go @@ -5,7 +5,7 @@ package context import ( - "code.gitea.io/gitea/models" + "code.gitea.io/gitea/models/unit" "code.gitea.io/gitea/modules/log" ) @@ -20,7 +20,7 @@ func RequireRepoAdmin() func(ctx *Context) { } // RequireRepoWriter returns a middleware for requiring repository write to the specify unitType -func RequireRepoWriter(unitType models.UnitType) func(ctx *Context) { +func RequireRepoWriter(unitType unit.Type) func(ctx *Context) { return func(ctx *Context) { if !ctx.Repo.CanWrite(unitType) { ctx.NotFound(ctx.Req.URL.RequestURI(), nil) @@ -30,7 +30,7 @@ func RequireRepoWriter(unitType models.UnitType) func(ctx *Context) { } // RequireRepoWriterOr returns a middleware for requiring repository write to one of the unit permission -func RequireRepoWriterOr(unitTypes ...models.UnitType) func(ctx *Context) { +func RequireRepoWriterOr(unitTypes ...unit.Type) func(ctx *Context) { return func(ctx *Context) { for _, unitType := range unitTypes { if ctx.Repo.CanWrite(unitType) { @@ -42,7 +42,7 @@ func RequireRepoWriterOr(unitTypes ...models.UnitType) func(ctx *Context) { } // RequireRepoReader returns a middleware for requiring repository read to the specify unitType -func RequireRepoReader(unitType models.UnitType) func(ctx *Context) { +func RequireRepoReader(unitType unit.Type) func(ctx *Context) { return func(ctx *Context) { if !ctx.Repo.CanRead(unitType) { if log.IsTrace() { @@ -68,7 +68,7 @@ func RequireRepoReader(unitType models.UnitType) func(ctx *Context) { } // RequireRepoReaderOr returns a middleware for requiring repository write to one of the unit permission -func RequireRepoReaderOr(unitTypes ...models.UnitType) func(ctx *Context) { +func RequireRepoReaderOr(unitTypes ...unit.Type) func(ctx *Context) { return func(ctx *Context) { for _, unitType := range unitTypes { if ctx.Repo.CanRead(unitType) { |