-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find id/pw 기능 추가 & RBAC 기능 추가 #43
Conversation
internal/delivery/http/user.go
Outdated
@@ -45,10 +50,9 @@ func NewUserHandler(h usecase.IUserUsecase) IUserHandler { | |||
// @Router /organizations/{organizationId}/users [post] | |||
// @Security JWT | |||
func (u UserHandler) Create(w http.ResponseWriter, r *http.Request) { | |||
vars := mux.Vars(r) | |||
organizationId, ok := vars["organizationId"] | |||
requestUserInfo, ok := request.UserFrom(r.Context()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path variable 의 organizationId 가 아닌 token 의 organizationId 를 사용하는 의도가 무엇인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
잘못된 부분 같습니다. 요청자와 요청에 대한 자원의 org가 반드시 같을 것이라 생각했는데 아닐 수 있는 경우에 대해 처리하려면 path variable을 사용하는게 맞는것 같습니다.
수정할게요.
internal/delivery/http/user.go
Outdated
@@ -259,16 +263,20 @@ func (u UserHandler) Update(w http.ResponseWriter, r *http.Request) { | |||
ctx := r.Context() | |||
var user domain.User | |||
if err = domain.Map(input, &user); err != nil { | |||
log.Error(err) | |||
ErrorJSON(w, httpErrors.NewInternalServerError(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrorJSON(w, err) 와 결과는 같습니다. 참고하세요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다
internal/helper/util.go
Outdated
func GenerateEmailCode() string { | ||
num, err := rand.Int(rand.Reader, big.NewInt(900000)) | ||
if err != nil { | ||
panic(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic 은 위험한 코드입니다. log.error 로 변경해주시고, err 를 리턴하여 caller 에서 error 를 처리하도록 변경해주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다.
User: repository.NewUserRepository(db), | ||
Cluster: repository.NewClusterRepository(db), | ||
Organization: repository.NewOrganizationRepository(db), | ||
AppGroup: repository.NewAppGroupRepository(db), | ||
AppServeApp: repository.NewAppServeAppRepository(db), | ||
CloudAccount: repository.NewCloudAccountRepository(db), | ||
StackTemplate: repository.NewStackTemplateRepository(db), | ||
Alert: repository.NewAlertRepository(db), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 올렸던 코드가 빠졌네요. conflit 처리시 miss 가 있었나봅니다. 다시 넣어주세요
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/alerts/{alertId}/actions", authMiddleware.Handle(http.HandlerFunc(alertHandler.CreateAlertAction))).Methods(http.MethodPost) | ||
//r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/alerts/{alertId}/actions/status", authMiddleware.Handle(http.HandlerFunc(alertHandler.UpdateAlertActionStatus))).Methods(http.MethodPatch) | ||
|
||
r.HandleFunc(API_PREFIX+API_VERSION+"/alerttest", alertHandler.CreateAlert).Methods(http.MethodPost) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도...
AWS SES를 통한 id/pw 찾기 기능 추가