Skip to content
Permalink
Browse files
fix nil perm issue
  • Loading branch information
bradrydzewski committed Sep 14, 2017
1 parent 2f2144c commit 63ba6af242c51f104399060f9b7fb000baed4364
Showing 1 changed file with 5 additions and 1 deletion.
@@ -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

0 comments on commit 63ba6af

Please sign in to comment.