Skip to content

Commit 2657899

Browse files
committed
deepsource sug fix - ommit comparison
1 parent 80f5534 commit 2657899

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

api/restHandler/UserRestHandler.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (handler UserRestHandlerImpl) GetById(w http.ResponseWriter, r *http.Reques
211211
writeJsonResp(w, err, "Failed to get by id", http.StatusInternalServerError)
212212
return
213213
}
214-
actionUserSuperAdmin, err := handler.userService.IsSuperAdmin(int(userId))
214+
isActionUserSuperAdmin, err := handler.userService.IsSuperAdmin(int(userId))
215215
if err != nil {
216216
handler.logger.Errorw("service err, GetById", "err", err, "id", id)
217217
writeJsonResp(w, err, "Failed to check is super admin", http.StatusInternalServerError)
@@ -229,7 +229,7 @@ func (handler UserRestHandlerImpl) GetById(w http.ResponseWriter, r *http.Reques
229229
}
230230
}
231231
}
232-
if actionUserSuperAdmin == true {
232+
if isActionUserSuperAdmin {
233233
authPass = true
234234
}
235235
if authPass == false {

pkg/user/UserService.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -317,20 +317,20 @@ func (impl UserServiceImpl) UpdateUser(userInfo *bean.UserInfo) (*bean.UserInfo,
317317
if err != nil {
318318
return nil, err
319319
}
320-
IsActionPerformingUserSuperAdmin, err := impl.IsSuperAdmin(int(userInfo.UserId))
320+
isActionPerformingUserSuperAdmin, err := impl.IsSuperAdmin(int(userInfo.UserId))
321321
if err != nil {
322322
return nil, err
323323
}
324324
//if request comes to make user as a super admin, action performing user also be super admin
325325
if userInfo.SuperAdmin {
326-
if IsActionPerformingUserSuperAdmin == false {
326+
if !isUserSuperAdmin {
327327
err = &util.ApiError{HttpStatusCode: http.StatusForbidden, UserMessage: "Invalid request, not allow to update super admin type user"}
328328
return nil, err
329329
}
330330
}
331331
//if user which going to updated is super admin, action performing user also be super admin
332332
if isUserSuperAdmin == true {
333-
if IsActionPerformingUserSuperAdmin == false {
333+
if !isActionPerformingUserSuperAdmin {
334334
err = &util.ApiError{HttpStatusCode: http.StatusForbidden, UserMessage: "Invalid request, not allow to update super admin type user"}
335335
return nil, err
336336
}

0 commit comments

Comments
 (0)