Sha256: 9f2c40b7c3bfe6acb331567f00f6bfea3703021a7d5b4438ebbafb033fe9010b

Contents?: true

Size: 920 Bytes

Versions: 17

Compression:

Stored size: 920 Bytes

Contents

class Iugu::SettingsController < ApplicationController

  before_filter :authenticate_user!, :except => :add_social
  before_filter :verify_token

  layout IuguSDK.default_layout

  def index
    redirect_to :profile_settings, :notice => flash[:notice]
  end

  def must_be (roles, param_name)
    access = false
    @account_user = AccountUser.find_by_user_id_and_account_id(current_user.id, params[param_name])
    raise ActionController::RoutingError.new("Not Found") unless @account_user
    if roles.class == Array
      roles.each do |role|
        access = true if @account_user.is?(role)
      end
    else
      access = true if @account_user.is?(roles)
    end
    raise ActionController::RoutingError.new("Access Denied") if access == false
  end

  private

  def verify_token
    if IuguSDK::enable_user_api and current_user
      current_user.send(:init_token) unless current_user.token
    end
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
iugusdk-1.0.11 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.10 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.9 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.8 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.7 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.6 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.5 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.4 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.3 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.2 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.1 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.0.alpha.32 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.0.alpha.31 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.0.alpha.30 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.0.alpha.29 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.0.alpha.28 app/controllers/iugu/settings_controller.rb
iugusdk-1.0.0.alpha.27 app/controllers/iugu/settings_controller.rb