add org structure
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
func GetFileFromStore(c echo.Context) error {
|
||||
fileName := strings.ReplaceAll(c.Request().RequestURI, "/store", "")
|
||||
|
||||
data, err, req := api.GetRequest(
|
||||
data, err, resp := api.GetRequest(
|
||||
config.Env.MSHosts.StoreHost+fileName,
|
||||
c.Request().Header,
|
||||
)
|
||||
@@ -19,5 +19,5 @@ func GetFileFromStore(c echo.Context) error {
|
||||
return c.NoContent(http.StatusBadGateway)
|
||||
}
|
||||
|
||||
return c.Blob(req.StatusCode, req.Header.Get("Content-Type"), data)
|
||||
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
||||
}
|
||||
|
||||
@@ -38,6 +38,10 @@ func Login(c echo.Context) (err error) {
|
||||
claims := token.Claims.(jwt.MapClaims)
|
||||
claims["id"] = strconv.Itoa(int(u.ID))
|
||||
claims["exp"] = time.Now().Add(time.Hour * 72).Unix()
|
||||
claims["role"] = u.Role
|
||||
claims["position_name"] = u.Position.Name
|
||||
claims["position_rm"] = strconv.Itoa(u.Position.RightMask)
|
||||
claims["position_org_id"] = strconv.Itoa(int(u.Position.OrganizationID))
|
||||
|
||||
var _token, _ = token.SignedString([]byte(config.Env.Server.JWTSecret))
|
||||
if err != nil {
|
||||
@@ -109,3 +113,15 @@ func UpdateUser(c echo.Context) (err error) {
|
||||
|
||||
return c.JSONBlob(http.StatusOK, data)
|
||||
}
|
||||
|
||||
func GetOrganizations(c echo.Context) error {
|
||||
data, err, resp := api.GetRequest(
|
||||
config.Env.MSHosts.UsersHost+"/organizations",
|
||||
c.Request().Header, c.Request().URL.RawQuery)
|
||||
|
||||
if err != nil {
|
||||
return c.NoContent(http.StatusBadGateway)
|
||||
}
|
||||
|
||||
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user