Sha256: 46ae033f4853d85a5890e4f706502f699942a56e063ca8b56d4e082873db0662

Contents?: true

Size: 710 Bytes

Versions: 10

Compression:

Stored size: 710 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    module Abilities
      # Defines the abilities for a user in the admin section. Intended to be
      # used with `cancancan`. Extended by both the base `Decidim::Ability`
      # class and other engine-only abilities, like the
      # `ParticipatoryProcessAdmin` ability class.
      class Base
        include CanCan::Ability

        def initialize(user, context)
          merge ::Decidim::Ability.new(user, context)
          merge ParticipatoryProcessAdmin.new(user, context)

          Decidim.admin_abilities.each do |ability|
            merge ability.constantize.new(user, context)
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
decidim-admin-0.4.0 app/models/decidim/admin/abilities/base.rb
decidim-0.4.0 decidim-admin/app/models/decidim/admin/abilities/base.rb
decidim-admin-0.3.2 app/models/decidim/admin/abilities/base.rb
decidim-0.3.2 decidim-admin/app/models/decidim/admin/abilities/base.rb
decidim-admin-0.3.1 app/models/decidim/admin/abilities/base.rb
decidim-0.3.1 decidim-admin/app/models/decidim/admin/abilities/base.rb
decidim-admin-0.3.0 app/models/decidim/admin/abilities/base.rb
decidim-0.3.0 decidim-admin/app/models/decidim/admin/abilities/base.rb
decidim-admin-0.2.0 app/models/decidim/admin/abilities/base.rb
decidim-0.2.0 decidim-admin/app/models/decidim/admin/abilities/base.rb