Class: Pageflow::FilePolicy

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/pageflow/file_policy.rb

Instance Method Summary collapse

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

Returns:

  • (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

Returns:

  • (Boolean)


16
17
18
# File 'app/policies/pageflow/file_policy.rb', line 16

def use?
  can_preview_any_entry_using_file?
end