Sha256: c6b3583a5754d7111907f7af19fd151f962c49c9f852b1b72fb1b5fe03f7a855

Contents?: true

Size: 1.08 KB

Versions: 14

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  # The UserProfile concern must be included in all the controllers
  # that are shown in the user's profile settings. It adds the
  # proper layout, as well as helper methods that help render the
  # side menu, amongst others.
  module UserProfile
    extend ActiveSupport::Concern
    include FormFactory

    delegate :user_groups, to: :current_user, prefix: false

    included do
      helper Decidim::UserProfileHelper
      layout "layouts/decidim/user_profile"

      helper_method :available_verification_workflows,
                    :user_groups

      before_action :current_user
      before_action do
        enforce_permission_to :update_profile, :user, current_user: current_user
      end
    end

    # Public: Available authorization handlers in order to conditionally
    # show the menu element.
    def available_verification_workflows
      Verifications::Adapter.from_collection(
        current_organization.available_authorizations & Decidim.authorization_workflows.map(&:name)
      )
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-core-0.15.2 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.15.1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.15.0 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.14.4 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.14.3 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.14.2 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.14.1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.13.1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.12.2 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.13.0 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.12.1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.13.0.pre1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.12.0 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.12.0.pre app/controllers/concerns/decidim/user_profile.rb