Module: ActionController::PermissionsPolicy::ClassMethods
- Defined in:
- lib/action_controller/metal/permissions_policy.rb
Instance Method Summary collapse
-
#permissions_policy(**options, &block) ⇒ Object
Overrides parts of the globally configured
Feature-Policy
header:.
Instance Method Details
#permissions_policy(**options, &block) ⇒ Object
Overrides parts of the globally configured Feature-Policy
header:
class PagesController < ApplicationController
do |policy|
policy.geolocation "https://example.com"
end
end
Options can be passed similar to before_action
. For example, pass only: :index
to override the header on the index action only:
class PagesController < ApplicationController
(only: :index) do |policy|
policy.camera :self
end
end
26 27 28 29 30 31 32 33 34 |
# File 'lib/action_controller/metal/permissions_policy.rb', line 26 def (**, &block) before_action() do if block_given? policy = request..clone yield policy request. = policy end end end |