Mercurial > gemma
comparison pkg/controllers/user.go @ 5553:0717168c1978
Distinguish in logging if user was deleted or deactivated.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 18 Nov 2021 16:18:01 +0100 |
parents | 5680c44ff6c0 |
children | 79155213c4da |
comparison
equal
deleted
inserted
replaced
5552:5680c44ff6c0 | 5553:0717168c1978 |
---|---|
174 Code: http.StatusNotFound, | 174 Code: http.StatusNotFound, |
175 Message: fmt.Sprintf("Cannot find user %s.", user), | 175 Message: fmt.Sprintf("Cannot find user %s.", user), |
176 } | 176 } |
177 return | 177 return |
178 case deleted: | 178 case deleted: |
179 log.Debugf("user '%s' was deleted.\n", user) | |
180 action = "deleted" | 179 action = "deleted" |
181 case updated: | 180 case updated: |
182 log.Debugf("user '%s' was deactivated.\n", user) | |
183 action = "deactivated" | 181 action = "deactivated" |
184 default: | 182 default: |
185 log.Errorf("Should not happen: user '%s' updated and deleted.\n", user) | 183 log.Errorf("Should not happen: user '%s' updated and deleted.\n", user) |
186 action = "deleted" | 184 action = "deleted" |
187 } | 185 } |
188 | 186 |
189 // Running in a go routine should not be necessary. | 187 // Running in a go routine should not be necessary. |
190 go func() { auth.Sessions.Logout(user) }() | 188 go func() { auth.Sessions.Logout(user) }() |
191 | 189 |
192 log.Infof("User '%s' deleted/deactivated.\n", user) | 190 log.Infof("User '%s' %s.\n", user, action) |
193 | 191 |
194 jr = mw.JSONResult{ | 192 jr = mw.JSONResult{ |
195 Result: struct { | 193 Result: struct { |
196 Action string `json:"action"` | 194 Action string `json:"action"` |
197 }{ | 195 }{ |