fix nil perm issue

This commit is contained in:
Brad Rydzewski 2017-09-14 15:20:20 -07:00
parent 2f2144c4bd
commit 63ba6af242

View file

@ -83,7 +83,7 @@ func SetPerm() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
user := User(c) user := User(c)
repo := Repo(c) repo := Repo(c)
perm := &model.Perm{} perm := new(model.Perm)
switch { switch {
case user != nil: case user != nil:
@ -105,6 +105,10 @@ func SetPerm() gin.HandlerFunc {
} }
} }
if perm == nil {
perm = new(model.Perm)
}
if user != nil && user.Admin { if user != nil && user.Admin {
perm.Pull = true perm.Pull = true
perm.Push = true perm.Push = true