module Authoreyes::Authorization

Constants

AUTH_DSL_FILES

Public Class Methods

current_user() click to toggle source

Controller-independent method for retrieving the current user. Needed for model security where the current controller is not available.

# File lib/authoreyes/authorization.rb, line 34
def self.current_user
  # TODO: get rid of Thread usage
  Thread.current['current_user'] || AnonymousUser.new
end
current_user=(user) click to toggle source

Controller-independent method for setting the current user.

# File lib/authoreyes/authorization.rb, line 40
def self.current_user=(user)
  Thread.current['current_user'] = user
end
default_role() click to toggle source
# File lib/authoreyes/authorization.rb, line 64
def self.default_role
  @@default_role
end
default_role=(role) click to toggle source
# File lib/authoreyes/authorization.rb, line 68
def self.default_role=(role)
  @@default_role = role.to_sym
end
dot_path() click to toggle source
# File lib/authoreyes/authorization.rb, line 55
def self.dot_path
  @@dot_path
end
dot_path=(path) click to toggle source
# File lib/authoreyes/authorization.rb, line 59
def self.dot_path=(path)
  @@dot_path = path
end
is_a_association_proxy?(object) click to toggle source
# File lib/authoreyes/authorization.rb, line 72
def self.is_a_association_proxy?(object)
  if Rails.version < '3.2'
    object.respond_to?(:proxy_reflection)
  else
    object.respond_to?(:proxy_association)
  end
end