Skip to content

Commit 050332c

Browse files
author
raccoon-mh
committed
fix menu endpoint mciam
1 parent 9df3483 commit 050332c

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

api/actions/app.go

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func App() *buffalo.App {
3838
SessionName: "mc_web_console",
3939
Addr: os.Getenv("API_ADDR") + ":" + os.Getenv("API_PORT"),
4040
})
41-
4241
app.Use(paramlogger.ParameterLogger)
4342
app.Use(contenttype.Set("application/json"))
4443
app.Use(popmw.Transaction(models.DB))

api/actions/auth.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ func AuthLoginRefresh(c buffalo.Context) error {
5353
userId := c.Value("UserId").(string)
5454
sess, err := self.GetUserByUserId(tx, userId)
5555
if err != nil {
56-
log.Println(err.Error())
56+
app.Logger.Error(err.Error())
5757
commonResponse := handler.CommonResponseStatusBadRequest(err.Error())
5858
return c.Render(commonResponse.Status.StatusCode, r.JSON(commonResponse))
5959
}
6060

6161
tokenSet, err := self.RefreshAccessToken(sess.RefreshToken)
6262
if err != nil {
63-
log.Println(err.Error())
63+
app.Logger.Error(err.Error())
6464
commonResponse := handler.CommonResponseStatusBadRequest(err.Error())
6565
return c.Render(commonResponse.Status.StatusCode, r.JSON(commonResponse))
6666
}
@@ -72,7 +72,7 @@ func AuthLoginRefresh(c buffalo.Context) error {
7272

7373
_, err = self.UpdateUserSess(tx, sess)
7474
if err != nil {
75-
log.Println(err.Error())
75+
app.Logger.Error(err.Error())
7676
commonResponse := handler.CommonResponseStatusBadRequest(err.Error())
7777
return c.Render(commonResponse.Status.StatusCode, r.JSON(commonResponse))
7878
}

api/actions/middleware.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package actions
22

33
import (
44
"fmt"
5-
"log"
65
"mc_web_console_api/handler/self"
76
"net/http"
87
"strings"
@@ -18,7 +17,7 @@ func DefaultMiddleware(next buffalo.Handler) buffalo.Handler {
1817
accessToken := strings.TrimPrefix(c.Request().Header.Get("Authorization"), "Bearer ")
1918
claims, err := self.GetCmigTokenClaims(accessToken)
2019
if err != nil {
21-
log.Println(err.Error())
20+
app.Logger.Error(err.Error())
2221
return c.Render(http.StatusUnauthorized, render.JSON(map[string]interface{}{"error": "Unauthorized"}))
2322
}
2423
tx := c.Value("tx").(*pop.Connection)

api/go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ require (
1616
github.com/gobuffalo/validate/v3 v3.3.3
1717
github.com/gobuffalo/x v0.1.0
1818
github.com/gofrs/uuid v4.4.0+incompatible
19+
github.com/golang-jwt/jwt/v5 v5.2.1
1920
github.com/m-cmp/mc-iam-manager v0.2.10
2021
github.com/opentracing/opentracing-go v1.2.0
2122
github.com/rs/cors v1.11.0
2223
github.com/spf13/viper v1.19.0
24+
golang.org/x/crypto v0.26.0
25+
gopkg.in/yaml.v2 v2.4.0
2326
)
2427

2528
require (
@@ -46,7 +49,6 @@ require (
4649
github.com/gobuffalo/refresh v1.13.3 // indirect
4750
github.com/gobuffalo/tags/v3 v3.1.4 // indirect
4851
github.com/goccy/go-json v0.10.3 // indirect
49-
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
5052
github.com/gorilla/css v1.0.1 // indirect
5153
github.com/gorilla/handlers v1.5.2 // indirect
5254
github.com/gorilla/mux v1.8.1 // indirect
@@ -99,7 +101,6 @@ require (
99101
github.com/subosito/gotenv v1.6.0 // indirect
100102
go.uber.org/atomic v1.9.0 // indirect
101103
go.uber.org/multierr v1.9.0 // indirect
102-
golang.org/x/crypto v0.26.0 // indirect
103104
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
104105
golang.org/x/mod v0.18.0 // indirect
105106
golang.org/x/net v0.26.0 // indirect
@@ -109,6 +110,5 @@ require (
109110
golang.org/x/text v0.17.0 // indirect
110111
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
111112
gopkg.in/ini.v1 v1.67.0 // indirect
112-
gopkg.in/yaml.v2 v2.4.0 // indirect
113113
gopkg.in/yaml.v3 v3.0.1 // indirect
114114
)

api/handler/self/menu.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ func getCreateWebMenuByYamlEndpoint() string {
170170
log.Fatalf("Error reading config file, %s", err)
171171
}
172172
baseUrl := viper.Get("services.mc-iam-manager.baseurl").(string)
173-
createwebmenubyyamlUri := viper.Get("serviceActions.mc-iam-manager.Createwebmenubyyaml.resourcePath").(string)
173+
createwebmenubyyamlUri := viper.Get("serviceActions.mc-iam-manager.Createmenuresourcesbymenuyaml.resourcePath").(string)
174174
urlModified := strings.ReplaceAll(baseUrl+createwebmenubyyamlUri, "{framework}", "web")
175-
fmt.Println("Createwebmenubyyaml Endpoint is : ", urlModified)
176175
return urlModified
177176
}

0 commit comments

Comments
 (0)