Sha256: 99ce53151c4a2a89d7ba7dc1a6c5bd944d496a8acfc18f80ac799fc308de9db7

Contents?: true

Size: 642 Bytes

Versions: 71

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  # The UserGroups concern must be included in all controllers related
  # to UserGroups feature. It adds a method to enforce that the feature
  # is enabled.
  module UserGroups
    extend ActiveSupport::Concern

    included do
      delegate :user_groups, to: :current_user, prefix: false
      delegate :user_groups_enabled?, to: :current_organization

      helper_method :user_groups, :user_groups_enabled?
    end

    def enforce_user_groups_enabled
      raise Decidim::ActionForbidden unless current_organization.user_groups_enabled?
    end
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
decidim-core-0.25.0.rc4 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.25.0.rc3 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.25.0.rc2 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.25.0.rc1 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.24.3 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.23.6 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.24.2 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.23.5 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.24.1 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.24.0 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.24.0.rc2 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.23.4 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.24.0.rc1 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.23.3 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.23.2 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.23.1 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.23.1.rc1 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.23.0 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.22.0 app/controllers/concerns/decidim/user_groups.rb
decidim-core-0.21.0 app/controllers/concerns/decidim/user_groups.rb