mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Move accessmode into models/perm (#17828)
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/perm"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
@@ -37,7 +38,7 @@ func appendPrivateInformation(apiKey *api.PublicKey, key *models.PublicKey, defa
|
||||
} else {
|
||||
apiKey.KeyType = "unknown"
|
||||
}
|
||||
apiKey.ReadOnly = key.Mode == models.AccessModeRead
|
||||
apiKey.ReadOnly = key.Mode == perm.AccessModeRead
|
||||
return apiKey, nil
|
||||
}
|
||||
|
||||
|
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/perm"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
@@ -37,7 +38,7 @@ func listUserRepos(ctx *context.APIContext, u *user_model.User, private bool) {
|
||||
ctx.Error(http.StatusInternalServerError, "AccessLevel", err)
|
||||
return
|
||||
}
|
||||
if ctx.IsSigned && ctx.User.IsAdmin || access >= models.AccessModeRead {
|
||||
if ctx.IsSigned && ctx.User.IsAdmin || access >= perm.AccessModeRead {
|
||||
apiRepos = append(apiRepos, convert.ToRepo(repos[i], access))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user