Sha256: fbd7ad168a65b3ec8828daaa6a51432f13e37906cf31c6057f65164a5b348fa4

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

module Opro::Controllers::Concerns::ErrorMessages
  extend ActiveSupport::Concern

  def generate_oauth_error_message!
    msg = ""
    msg << ' - No OAuth Token Provided!'    if oauth_access_token.blank?
    msg << ' - Allow OAuth set to false!'   if allow_oauth? == false
    msg << ' - OAuth user not found!'       if oauth_user.blank?
    msg = generate_oauth_permissions_error_message!(msg)
    msg
  end

  def generate_oauth_permissions_error_message!(msg = '')
    if !oauth_client_has_permissions?
      msg << ' - OAuth client not permitted'
      oauth_required_permissions.each do |permission|
        msg << "- #{permission} permission required;" unless oauth_client_has_permission?(permission)
      end
    end
    msg
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opro-0.3.0.pre1 lib/opro/controllers/concerns/error_messages.rb
opro-0.3.0.pre lib/opro/controllers/concerns/error_messages.rb