Sha256: 7664edc7e68aed276c9298cea678fe042cb03390f3ee5546f3fa5a708265d616

Contents?: true

Size: 747 Bytes

Versions: 6

Compression:

Stored size: 747 Bytes

Contents

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

  def generate_oauth_error_message!
    msg = ""
    msg << ' - No OAuth Token Provided!'    if params[: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

6 entries across 6 versions & 1 rubygems

Version Path
opro-0.2.1.pre lib/opro/controllers/concerns/error_messages.rb
opro-0.2.0 lib/opro/controllers/concerns/error_messages.rb
opro-0.1.0 lib/opro/controllers/concerns/error_messages.rb
opro-0.0.3 lib/opro/controllers/concerns/error_messages.rb
opro-0.0.2 lib/opro/controllers/concerns/error_messages.rb
opro-0.0.1 lib/opro/controllers/concerns/error_messages.rb