fix nil perm issue
This commit is contained in:
parent
2f2144c4bd
commit
63ba6af242
1 changed files with 5 additions and 1 deletions
|
@ -83,7 +83,7 @@ func SetPerm() gin.HandlerFunc {
|
|||
return func(c *gin.Context) {
|
||||
user := User(c)
|
||||
repo := Repo(c)
|
||||
perm := &model.Perm{}
|
||||
perm := new(model.Perm)
|
||||
|
||||
switch {
|
||||
case user != nil:
|
||||
|
@ -105,6 +105,10 @@ func SetPerm() gin.HandlerFunc {
|
|||
}
|
||||
}
|
||||
|
||||
if perm == nil {
|
||||
perm = new(model.Perm)
|
||||
}
|
||||
|
||||
if user != nil && user.Admin {
|
||||
perm.Pull = true
|
||||
perm.Push = true
|
||||
|
|
Loading…
Reference in a new issue