Class: Thredded::MessageboardPolicy
- Inherits:
-
Object
- Object
- Thredded::MessageboardPolicy
- Defined in:
- app/policies/thredded/messageboard_policy.rb
Defined Under Namespace
Classes: Scope
Instance Method Summary collapse
- #create? ⇒ Boolean
-
#initialize(user, messageboard) ⇒ MessageboardPolicy
constructor
A new instance of MessageboardPolicy.
- #moderate? ⇒ Boolean
- #post? ⇒ Boolean
- #read? ⇒ Boolean
- #update? ⇒ Boolean
Constructor Details
#initialize(user, messageboard) ⇒ MessageboardPolicy
Returns a new instance of MessageboardPolicy.
22 23 24 25 |
# File 'app/policies/thredded/messageboard_policy.rb', line 22 def initialize(user, ) @user = user @messageboard = end |
Instance Method Details
#create? ⇒ Boolean
27 28 29 |
# File 'app/policies/thredded/messageboard_policy.rb', line 27 def create? @user.thredded_admin? end |
#moderate? ⇒ Boolean
45 46 47 |
# File 'app/policies/thredded/messageboard_policy.rb', line 45 def moderate? @user.thredded_admin? || @user..include?(@messageboard) end |
#post? ⇒ Boolean
39 40 41 42 43 |
# File 'app/policies/thredded/messageboard_policy.rb', line 39 def post? @user.thredded_admin? || (!@messageboard.locked? || moderate?) && @user..include?(@messageboard) end |
#read? ⇒ Boolean
31 32 33 |
# File 'app/policies/thredded/messageboard_policy.rb', line 31 def read? @user.thredded_admin? || @user..include?(@messageboard) end |
#update? ⇒ Boolean
35 36 37 |
# File 'app/policies/thredded/messageboard_policy.rb', line 35 def update? @user.thredded_admin? end |