Sha256: 822d2d62b5f594609df4bf783092116a5a55670be1b935e9d07d907054fd289f

Contents?: true

Size: 643 Bytes

Versions: 4

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true
require_dependency "decidim/application_controller"

module Decidim
  # The controller to handle the user's account page.
  class AccountController < ApplicationController
    helper_method :authorizations, :handlers
    authorize_resource :user_account, class: false

    private

    def handlers
      @handlers ||= Decidim.authorization_handlers.reject do |handler|
        authorized_handlers.include?(handler.handler_name)
      end
    end

    def authorizations
      @authorizations ||= current_user.authorizations
    end

    def authorized_handlers
      authorizations.map(&:name)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-core-0.0.2 app/controllers/decidim/account_controller.rb
decidim-core-0.0.1 app/controllers/decidim/account_controller.rb
decidim-core-0.0.1.alpha9 app/controllers/decidim/account_controller.rb
decidim-core-0.0.1.alpha8 app/controllers/decidim/account_controller.rb