Skip to content

Commit

Permalink
[fix] #114
Browse files Browse the repository at this point in the history
  • Loading branch information
yoneyan committed Aug 23, 2021
1 parent c9b34ec commit 82c2d70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/api/core/user/v0/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func noticeSlack(loginUser, before core.User, after user.Input) {
attachment := slack.Attachment{}

groupStr := "なし"
if loginUser.Group != nil {
groupStr = strconv.Itoa(int(*loginUser.GroupID)) + "-" + before.Group.Org
if loginUser.GroupID != nil {
groupStr = strconv.Itoa(int(*loginUser.GroupID)) + "-" + loginUser.Group.Org
}

attachment.Text = &[]string{"User情報の更新"}[0]
Expand Down
6 changes: 4 additions & 2 deletions pkg/api/core/user/v0/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,12 @@ func Update(c *gin.Context) {
c.JSON(http.StatusInternalServerError, common.Error{Error: userResult.Err.Error()})
return
}
if userResult.User[0].GroupID != authResult.User.GroupID {
c.JSON(http.StatusInternalServerError, common.Error{Error: fmt.Sprintf("failed group authentication")})

if userResult.User[0].GroupID == nil || *userResult.User[0].GroupID != *authResult.User.GroupID {
c.JSON(http.StatusBadRequest, common.Error{Error: "error: This user does not belong to your group."})
return
}

serverData = userResult.User[0]
}

Expand Down

0 comments on commit 82c2d70

Please sign in to comment.