Sha256: 3727380e6944415a70c265a6caf8f8c6512dc9177205f3c5a4364cd482fac6fb

Contents?: true

Size: 578 Bytes

Versions: 3

Compression:

Stored size: 578 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Consultations
    module Abilities
      module Admin
        # Defines the abilities related to user able to administer question responses.
        # Intended to be used with `cancancan`.
        class ResponseAdminAbility
          include CanCan::Ability

          attr_reader :user, :context

          def initialize(user, context)
            return unless user&.admin?

            @user = user
            @context = context

            can :manage, Response
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-consultations-0.11.2 app/models/decidim/consultations/abilities/admin/response_admin_ability.rb
decidim-consultations-0.11.1 app/models/decidim/consultations/abilities/admin/response_admin_ability.rb
decidim-consultations-0.11.0.pre1 app/models/decidim/consultations/abilities/admin/response_admin_ability.rb