| 75 | } |
| 76 | |
| 77 | func (s *SimpleObjectInfo) canViewObject(userID string, isAdminModerator bool) bool { |
| 78 | if isAdminModerator { |
| 79 | return true |
| 80 | } |
| 81 | switch s.ObjectType { |
| 82 | case constant.QuestionObjectType: |
| 83 | return s.QuestionCreatorUserID == userID |
| 84 | case constant.AnswerObjectType, constant.CommentObjectType, constant.TagObjectType: |
| 85 | return s.ObjectCreatorUserID == userID |
| 86 | default: |
| 87 | return false |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | func (s *SimpleObjectInfo) canViewParentQuestion(userID string, isAdminModerator bool) bool { |
| 92 | if isAdminModerator { |