(userID string, isAdminModerator bool)
| 61 | } |
| 62 | |
| 63 | func (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 | |
| 77 | func (s *SimpleObjectInfo) canViewObject(userID string, isAdminModerator bool) bool { |
| 78 | if isAdminModerator { |
no test coverage detected