MCPcopy Index your code
hub / github.com/apache/answer / CheckVisibility

Method CheckVisibility

internal/schema/simple_obj_info_schema.go:63–75  ·  view source on GitHub ↗
(userID string, isAdminModerator bool)

Source from the content-addressed store, hash-verified

61}
62
63func (s *SimpleObjectInfo) CheckVisibility(userID string, isAdminModerator bool) error {
64 if s == nil {
65 return errors.NotFound(reason.ObjectNotFound)
66 }
67 if s.isObjectRestricted() && !s.canViewObject(userID, isAdminModerator) {
68 return errors.NotFound(s.objectNotFoundReason())
69 }
70 if s.hasParentQuestion() && s.isParentQuestionRestricted() &&
71 !s.canViewParentQuestion(userID, isAdminModerator) {
72 return errors.NotFound(reason.QuestionNotFound)
73 }
74 return nil
75}
76
77func (s *SimpleObjectInfo) canViewObject(userID string, isAdminModerator bool) bool {
78 if isAdminModerator {

Callers 3

GetCommentMethod · 0.80
GetCommentWithPageMethod · 0.80
GetRevisionListMethod · 0.80

Calls 6

isObjectRestrictedMethod · 0.95
canViewObjectMethod · 0.95
objectNotFoundReasonMethod · 0.95
hasParentQuestionMethod · 0.95
canViewParentQuestionMethod · 0.95

Tested by

no test coverage detected