Class: OrganizationAccessMode::Base
- Inherits:
-
Object
- Object
- OrganizationAccessMode::Base
show all
- Defined in:
- app/models/organization_access_mode/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(user, organization) ⇒ Base
Returns a new instance of Base.
4
5
6
7
|
# File 'app/models/organization_access_mode/base.rb', line 4
def initialize(user, organization)
@user = user
@organization = organization
end
|
Instance Attribute Details
#organization ⇒ Object
Returns the value of attribute organization.
2
3
4
|
# File 'app/models/organization_access_mode/base.rb', line 2
def organization
@organization
end
|
#user ⇒ Object
Returns the value of attribute user.
2
3
4
|
# File 'app/models/organization_access_mode/base.rb', line 2
def user
@user
end
|
Instance Method Details
#discuss_here? ⇒ Boolean
24
25
26
27
28
|
# File 'app/models/organization_access_mode/base.rb', line 24
def discuss_here?
organization.forum_enabled? && user.discusser_of?(organization) &&
user.trusted_as_discusser_in?(organization) && !user.banned_from_forum? &&
!user.currently_in_exam?
end
|
#faqs_here? ⇒ Boolean
12
13
14
|
# File 'app/models/organization_access_mode/base.rb', line 12
def faqs_here?
organization.faqs.present?
end
|
#read_only? ⇒ Boolean
42
43
44
|
# File 'app/models/organization_access_mode/base.rb', line 42
def read_only?
false
end
|
#resolve_discussions_here? ⇒ Boolean
20
21
22
|
# File 'app/models/organization_access_mode/base.rb', line 20
def resolve_discussions_here?
false
end
|
#restore_indicators?(_content) ⇒ Boolean
38
39
40
|
# File 'app/models/organization_access_mode/base.rb', line 38
def restore_indicators?(_content)
false
end
|
#show_content_element? ⇒ Boolean
34
35
36
|
# File 'app/models/organization_access_mode/base.rb', line 34
def show_content_element?
false
end
|
#show_discussion_element? ⇒ Boolean
30
31
32
|
# File 'app/models/organization_access_mode/base.rb', line 30
def show_discussion_element?
false
end
|
#submit_solutions_here? ⇒ Boolean
16
17
18
|
# File 'app/models/organization_access_mode/base.rb', line 16
def submit_solutions_here?
false
end
|
#validate_active! ⇒ Object
9
10
|
# File 'app/models/organization_access_mode/base.rb', line 9
def validate_active!
end
|
#validate_content_here!(content) ⇒ Object
50
51
52
|
# File 'app/models/organization_access_mode/base.rb', line 50
def validate_content_here!(content)
raise Mumuki::Domain::ForbiddenError unless show_content?(content)
end
|
#validate_discuss_here!(_discussion) ⇒ Object
46
47
48
|
# File 'app/models/organization_access_mode/base.rb', line 46
def validate_discuss_here!(_discussion)
raise Mumuki::Domain::ForbiddenError
end
|