Mercurial > gemma
comparison pkg/controllers/user.go @ 1544:5f80ec319a4f
If a user is removed or renamed kill her/his schedule. Needs more case on renaming.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 10 Dec 2018 13:17:50 +0100 |
parents | 5443f5c9154c |
children | 85386ad17d34 |
comparison
equal
deleted
inserted
replaced
1543:240bd1db49c0 | 1544:5f80ec319a4f |
---|---|
27 "github.com/gorilla/mux" | 27 "github.com/gorilla/mux" |
28 | 28 |
29 "gemma.intevation.de/gemma/pkg/auth" | 29 "gemma.intevation.de/gemma/pkg/auth" |
30 "gemma.intevation.de/gemma/pkg/misc" | 30 "gemma.intevation.de/gemma/pkg/misc" |
31 "gemma.intevation.de/gemma/pkg/models" | 31 "gemma.intevation.de/gemma/pkg/models" |
32 "gemma.intevation.de/gemma/pkg/scheduler" | |
32 ) | 33 ) |
33 | 34 |
34 const ( | 35 const ( |
35 createUserSQL = `INSERT INTO users.list_users | 36 createUserSQL = `INSERT INTO users.list_users |
36 VALUES ($1, $2, $3, $4, NULL, $5)` | 37 VALUES ($1, $2, $3, $4, NULL, $5)` |
126 return | 127 return |
127 } | 128 } |
128 | 129 |
129 // Running in a go routine should not be necessary. | 130 // Running in a go routine should not be necessary. |
130 go func() { auth.Sessions.Logout(user) }() | 131 go func() { auth.Sessions.Logout(user) }() |
132 go func() { scheduler.UnbindUser(user) }() | |
131 | 133 |
132 jr = JSONResult{Code: http.StatusNoContent} | 134 jr = JSONResult{Code: http.StatusNoContent} |
133 return | 135 return |
134 } | 136 } |
135 | 137 |
203 } | 205 } |
204 | 206 |
205 if user != newUser.User { | 207 if user != newUser.User { |
206 // Running in a go routine should not be necessary. | 208 // Running in a go routine should not be necessary. |
207 go func() { auth.Sessions.Logout(string(user)) }() | 209 go func() { auth.Sessions.Logout(string(user)) }() |
210 go func() { scheduler.UnbindUser(string(user)) }() | |
208 } | 211 } |
209 | 212 |
210 jr = JSONResult{ | 213 jr = JSONResult{ |
211 Code: http.StatusCreated, | 214 Code: http.StatusCreated, |
212 Result: struct { | 215 Result: struct { |