define context keysessionid using go-vise --withcontext
This commit is contained in:
parent
3ce1435591
commit
62f3681b9e
@ -28,7 +28,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
logg = logging.NewVanilla().WithDomain("ussdmenuhandler")
|
logg = logging.NewVanilla().WithDomain("ussdmenuhandler").WithContextKey("session-id")
|
||||||
scriptDir = path.Join("services", "registration")
|
scriptDir = path.Join("services", "registration")
|
||||||
translationDir = path.Join(scriptDir, "locale")
|
translationDir = path.Join(scriptDir, "locale")
|
||||||
)
|
)
|
||||||
@ -122,9 +122,12 @@ func (h *Handlers) Init(ctx context.Context, sym string, input []byte) (resource
|
|||||||
h.st.Code = []byte{}
|
h.st.Code = []byte{}
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionId, _ := ctx.Value("SessionId").(string)
|
sessionId, ok := ctx.Value("SessionId").(string)
|
||||||
flag_admin_privilege, _ := h.flagManager.GetFlag("flag_admin_privilege")
|
if ok {
|
||||||
|
context.WithValue(ctx, "session-id", sessionId)
|
||||||
|
}
|
||||||
|
|
||||||
|
flag_admin_privilege, _ := h.flagManager.GetFlag("flag_admin_privilege")
|
||||||
isAdmin, _ := h.adminstore.IsAdmin(sessionId)
|
isAdmin, _ := h.adminstore.IsAdmin(sessionId)
|
||||||
|
|
||||||
if isAdmin {
|
if isAdmin {
|
||||||
|
Loading…
Reference in New Issue
Block a user