MCPcopy
hub / github.com/apache/answer / CheckOperationObjectOwner

Method CheckOperationObjectOwner

internal/service/rank/rank_service.go:162–175  ·  view source on GitHub ↗

CheckOperationObjectOwner check operation object owner

(ctx context.Context, userID, objectID string)

Source from the content-addressed store, hash-verified

160
161// CheckOperationObjectOwner check operation object owner
162func (rs *RankService) CheckOperationObjectOwner(ctx context.Context, userID, objectID string) bool {
163 objectID = uid.DeShortID(objectID)
164 objectInfo, err := rs.objectInfoService.GetInfo(ctx, objectID)
165 if err != nil {
166 log.Error(err)
167 return false
168 }
169 // if the user is this object creator, the user can operate this object.
170 if objectInfo != nil &&
171 objectInfo.ObjectCreatorUserID == userID {
172 return true
173 }
174 return false
175}
176
177// CheckVotePermission verify that the user has vote permission
178func (rs *RankService) CheckVotePermission(ctx context.Context, userID, objectID string, voteUp bool) (

Callers 6

UpdateCommentMethod · 0.80
GetQuestionMethod · 0.80
UpdateQuestionMethod · 0.80
RemoveAnswerMethod · 0.80
AddAnswerMethod · 0.80
UpdateAnswerMethod · 0.80

Calls 2

DeShortIDFunction · 0.92
GetInfoMethod · 0.80

Tested by

no test coverage detected