Class: Pageflow::FilePolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- Pageflow::FilePolicy
- Defined in:
- app/policies/pageflow/file_policy.rb
Instance Method Summary collapse
-
#initialize(user, file) ⇒ FilePolicy
constructor
A new instance of FilePolicy.
- #manage? ⇒ Boolean
- #use? ⇒ Boolean
Constructor Details
#initialize(user, file) ⇒ FilePolicy
Returns a new instance of FilePolicy.
3 4 5 6 |
# File 'app/policies/pageflow/file_policy.rb', line 3 def initialize(user, file) @user = user @file = file end |
Instance Method Details
#manage? ⇒ Boolean
8 9 10 11 12 13 14 |
# File 'app/policies/pageflow/file_policy.rb', line 8 def manage? if @file.parent_file can_edit_any_entry_using_file?(@file.parent_file) else can_edit_any_entry_using_file?(@file) end end |
#use? ⇒ Boolean
16 17 18 |
# File 'app/policies/pageflow/file_policy.rb', line 16 def use? can_preview_any_entry_using_file? end |