Skip to content
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

Merged
merged 11 commits into from
Apr 26, 2023

Conversation

cho4036
Copy link
Contributor

@cho4036 cho4036 commented Apr 26, 2023

AWS SES를 통한 id/pw 찾기 기능 추가

@cho4036 cho4036 requested a review from ktkfree April 26, 2023 06:58
@@ -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())
Copy link
Contributor

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 를 사용하는 의도가 무엇인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘못된 부분 같습니다. 요청자와 요청에 대한 자원의 org가 반드시 같을 것이라 생각했는데 아닐 수 있는 경우에 대해 처리하려면 path variable을 사용하는게 맞는것 같습니다.
수정할게요.

@@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ErrorJSON(w, err) 와 결과는 같습니다. 참고하세요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정했습니다

func GenerateEmailCode() string {
num, err := rand.Int(rand.Reader, big.NewInt(900000))
if err != nil {
panic(err)
Copy link
Contributor

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 를 처리하도록 변경해주세요

Copy link
Contributor Author

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),
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도...

@ktkfree ktkfree merged commit 05e0f48 into openinfradev:develop Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants