Sha256: bd87cdcb04b7b71cd317e8aff5c035d9893228f3728723c811a668da81561e1e
Contents?: true
Size: 1.04 KB
Versions: 8
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module ActionController # :nodoc: module PermissionsPolicy extend ActiveSupport::Concern module ClassMethods # Overrides parts of the globally configured Feature-Policy # header: # # class PagesController < ApplicationController # permissions_policy do |policy| # policy.geolocation "https://example.com" # end # end # # Options can be passed similar to +before_action+. For example, pass # <tt>only: :index</tt> to override the header on the index action only: # # class PagesController < ApplicationController # permissions_policy(only: :index) do |policy| # policy.camera :self # end # end # def permissions_policy(**options, &block) before_action(options) do if block_given? policy = request.permissions_policy.clone yield policy request.permissions_policy = policy end end end end end end
Version data entries
8 entries across 8 versions & 2 rubygems