Sha256: 4c7c5b72911c0c8d0e5ce90a22cf42a77db328100619062ed8e01407ebe23c21

Contents?: true

Size: 577 Bytes

Versions: 10

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Comments
    module Abilities
      # Defines the abilities related to comments for a logged in admin user.
      # Intended to be used with `cancancan`.
      class AdminUser
        include CanCan::Ability

        attr_reader :user, :context

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

          @user = user
          @context = context

          can :manage, Comment
          can :unreport, Comment
          can :hide, Comment
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
decidim-comments-0.4.0 app/models/decidim/comments/abilities/admin_user.rb
decidim-0.4.0 decidim-comments/app/models/decidim/comments/abilities/admin_user.rb
decidim-comments-0.3.2 app/models/decidim/comments/abilities/admin_user.rb
decidim-0.3.2 decidim-comments/app/models/decidim/comments/abilities/admin_user.rb
decidim-comments-0.3.1 app/models/decidim/comments/abilities/admin_user.rb
decidim-0.3.1 decidim-comments/app/models/decidim/comments/abilities/admin_user.rb
decidim-comments-0.3.0 app/models/decidim/comments/abilities/admin_user.rb
decidim-0.3.0 decidim-comments/app/models/decidim/comments/abilities/admin_user.rb
decidim-comments-0.2.0 app/models/decidim/comments/abilities/admin_user.rb
decidim-0.2.0 decidim-comments/app/models/decidim/comments/abilities/admin_user.rb