diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-28 19:58:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-28 12:58:28 +0100 |
commit | 1fee11d69a437ec7e68b3f6b645827592fe77292 (patch) | |
tree | 1fca452f96746d9f7cc8c31723e3c365155cf96d /cmd | |
parent | 24a8d54bfb908a2371cb808a5243b3290dd0664a (diff) | |
download | gitea-1fee11d69a437ec7e68b3f6b645827592fe77292.tar.gz gitea-1fee11d69a437ec7e68b3f6b645827592fe77292.zip |
Move accessmode into models/perm (#17828)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/serv.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cmd/serv.go b/cmd/serv.go index 13c27f1ac0..e1a1d4cb72 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -17,6 +17,7 @@ import ( "time" "code.gitea.io/gitea/models" + "code.gitea.io/gitea/models/perm" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/log" @@ -64,11 +65,11 @@ func setup(logPath string, debug bool) { } var ( - allowedCommands = map[string]models.AccessMode{ - "git-upload-pack": models.AccessModeRead, - "git-upload-archive": models.AccessModeRead, - "git-receive-pack": models.AccessModeWrite, - lfsAuthenticateVerb: models.AccessModeNone, + allowedCommands = map[string]perm.AccessMode{ + "git-upload-pack": perm.AccessModeRead, + "git-upload-archive": perm.AccessModeRead, + "git-receive-pack": perm.AccessModeWrite, + lfsAuthenticateVerb: perm.AccessModeNone, } alphaDashDotPattern = regexp.MustCompile(`[^\w-\.]`) ) @@ -214,9 +215,9 @@ func runServ(c *cli.Context) error { if verb == lfsAuthenticateVerb { if lfsVerb == "upload" { - requestedMode = models.AccessModeWrite + requestedMode = perm.AccessModeWrite } else if lfsVerb == "download" { - requestedMode = models.AccessModeRead + requestedMode = perm.AccessModeRead } else { return fail("Unknown LFS verb", "Unknown lfs verb %s", lfsVerb) } |