Update
This commit is contained in:
@@ -41,6 +41,12 @@ func (m *AuthMiddleware) RequireAuth() gin.HandlerFunc {
|
||||
}
|
||||
|
||||
setKeyInContext(c, appcontext.UserIDKey, userResponse.ID.String())
|
||||
if len(userResponse.DepartmentResponse) > 0 {
|
||||
departmentID := userResponse.DepartmentResponse[0].ID.String()
|
||||
setKeyInContext(c, appcontext.DepartmentIDKey, departmentID)
|
||||
} else {
|
||||
setKeyInContext(c, appcontext.DepartmentIDKey, "")
|
||||
}
|
||||
|
||||
if roles, perms, err := m.authService.ExtractAccess(token); err == nil {
|
||||
c.Set("user_roles", roles)
|
||||
|
||||
@@ -13,7 +13,7 @@ func PopulateContext() gin.HandlerFunc {
|
||||
setKeyInContext(c, appcontext.AppVersionKey, getAppVersion(c))
|
||||
setKeyInContext(c, appcontext.AppTypeKey, getAppType(c))
|
||||
setKeyInContext(c, appcontext.OrganizationIDKey, getOrganizationID(c))
|
||||
setKeyInContext(c, appcontext.OutletIDKey, getOutletID(c))
|
||||
setKeyInContext(c, appcontext.DepartmentIDKey, getDepartmentID(c))
|
||||
setKeyInContext(c, appcontext.DeviceOSKey, getDeviceOS(c))
|
||||
setKeyInContext(c, appcontext.PlatformKey, getDevicePlatform(c))
|
||||
setKeyInContext(c, appcontext.UserLocaleKey, getUserLocale(c))
|
||||
@@ -37,8 +37,8 @@ func getOrganizationID(c *gin.Context) string {
|
||||
return c.GetHeader(constants.OrganizationID)
|
||||
}
|
||||
|
||||
func getOutletID(c *gin.Context) string {
|
||||
return c.GetHeader(constants.OutletID)
|
||||
func getDepartmentID(c *gin.Context) string {
|
||||
return c.GetHeader(constants.DepartmentID)
|
||||
}
|
||||
|
||||
func getDeviceOS(c *gin.Context) string {
|
||||
|
||||
Reference in New Issue
Block a user