mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-12 22:43:28 +00:00
Refactoring of the Access Table
This commit does a lot of the work of refactoring the access table in a table with id's instead of strings. The result does compile, but has not been tested. It may eat your kittens.
This commit is contained in:
1 parent
2804784df9
commit
0a4cda0dd4
12 files changed
+246
-733
No files matched your search
@@ -137,18 +137,18 @@ func Http(ctx *middleware.Context) {
|
||||
}
|
||||
|
||||
if !isPublicPull {
|
||||
var tp = models.WRITABLE
|
||||
var tp = models.WriteAccess
|
||||
if isPull {
|
||||
tp = models.READABLE
|
||||
tp = models.ReadAccess
|
||||
}
|
||||
|
||||
has, err := models.HasAccess(authUsername, username+"/"+reponame, tp)
|
||||
has, err := models.HasAccess(authUser, repo, tp)
|
||||
if err != nil {
|
||||
ctx.Handle(401, "no basic auth and digit auth", nil)
|
||||
return
|
||||
} else if !has {
|
||||
if tp == models.READABLE {
|
||||
has, err = models.HasAccess(authUsername, username+"/"+reponame, models.WRITABLE)
|
||||
if tp == models.ReadAccess {
|
||||
has, err = models.HasAccess(authUser, repo, models.WriteAccess)
|
||||
if err != nil || !has {
|
||||
ctx.Handle(401, "no basic auth and digit auth", nil)
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user