Sha256: 56c611e5e0965a2bdb71861156b96ed82697034581d39a03e6f89bcf2fa3dab9

Contents?: true

Size: 941 Bytes

Versions: 60

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  #
  # Including this concern will enable a `register_permissions` class method to
  # be used for configuring the permissions for the includer artifact.
  #
  module RegistersPermissions
    extend ActiveSupport::Concern

    def self.register_permissions(artifact, *permission_classes)
      ::Decidim.permissions_registry.register_permissions(artifact, *permission_classes)
    end

    class_methods do
      # Registers the permissions for the given `artifact`.
      #
      # +artifact+ is expected to be the class or module that declares `NeedsPermission.permission_class_chain`.
      # +permission_classes+ are subclasses of `DefaultPermissions` or at least should quack as one.
      def register_permissions(artifact, *permission_classes)
        RegistersPermissions.register_permissions(artifact, *permission_classes)
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.27.9 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.28.3 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.27.8 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.28.2 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.27.7 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.28.1 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.27.6 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.26.10 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.26.9 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.28.0 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.27.5 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.28.0.rc5 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.28.0.rc4 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.26.8 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.27.4 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.27.3 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.26.7 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.26.5 app/controllers/concerns/decidim/registers_permissions.rb
decidim-core-0.27.2 app/controllers/concerns/decidim/registers_permissions.rb