Class: Trek::FragmentPolicy

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/trek/fragment_policy.rb

Direct Known Subclasses

Admin::FragmentPolicy

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#preview?

Methods included from Policies::PermittedAttributes

#permitted_attribute?

Methods included from Policies::Helpers

#allow_admins!, #deny_guests!

Instance Method Details

#create?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/policies/trek/fragment_policy.rb', line 8

def create?
  user.privileged?
end

#index?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'app/policies/trek/fragment_policy.rb', line 4

def index?
  user.privileged?
end

#manage?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/policies/trek/fragment_policy.rb', line 12

def manage?
  user.privileged?
end

#permitted_attributesObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/policies/trek/fragment_policy.rb', line 16

def permitted_attributes
  if user.privileged?
    %i[
      content
      key
      namespace
      title
    ]
  else
    []
  end
end