Sha256: a249bebf7d21cdab1a885cab18929997a51dde2504c5d60924a3dadc64068a7e

Contents?: true

Size: 616 Bytes

Versions: 4

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Abilities
    # Defines the base abilities for any user. Guest users will use these too.
    # Intended to be used with `cancancan`.
    class EveryoneAbility
      include CanCan::Ability

      def initialize(user, _context)
        can :read, ParticipatoryProcessGroup
        can :read, ParticipatoryProcess, &:published?
        can :read, :public_pages
        can :manage, :locales

        can :read, Feature, &:published?

        can :search, Scope

        can :manage, User do |other|
          other == user
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
decidim-core-0.5.1 app/models/decidim/abilities/everyone_ability.rb
decidim-0.5.1 decidim-core/app/models/decidim/abilities/everyone_ability.rb
decidim-core-0.5.0 app/models/decidim/abilities/everyone_ability.rb
decidim-0.5.0 decidim-core/app/models/decidim/abilities/everyone_ability.rb