mirror of https://gitee.com/answerdev/answer.git
fix(rank): Incorrect permission verification
user can update answer that put by himself. admin can vote up anyway.
This commit is contained in:
parent
8c4dc92f58
commit
a6630670be
|
@ -161,7 +161,7 @@ func (ac *AnswerController) Update(ctx *gin.Context) {
|
|||
canList, err := ac.rankService.CheckOperationPermissions(ctx, req.UserID, []string{
|
||||
rank.AnswerEditRank,
|
||||
rank.AnswerEditWithoutReviewRank,
|
||||
}, "")
|
||||
}, req.ID)
|
||||
if err != nil {
|
||||
handler.HandleResponse(ctx, err, nil)
|
||||
return
|
||||
|
|
|
@ -170,6 +170,10 @@ func (rs *RankService) CheckVotePermission(ctx context.Context, userID, objectID
|
|||
if !exist {
|
||||
return can, nil
|
||||
}
|
||||
// administrator have all permissions
|
||||
if userInfo.IsAdmin {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
objectInfo, err := rs.objectInfoService.GetInfo(ctx, objectID)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue