Class: Pageflow::FilePolicy Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(user, file) ⇒ FilePolicy

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FilePolicy.



4
5
6
7
# File 'app/policies/pageflow/file_policy.rb', line 4

def initialize(user, file)
  @user = user
  @file = file
end

Instance Method Details

#manage?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


9
10
11
# File 'app/policies/pageflow/file_policy.rb', line 9

def manage?
  can_edit_any_entry_using_file?(@file.parent_file || @file)
end

#use?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


13
14
15
# File 'app/policies/pageflow/file_policy.rb', line 13

def use?
  can_preview_any_entry_using_file?
end