module Blacksand

Constants

DEFAULT_AUTHENTICATION

inspired by rails-admin github.com/sferik/rails_admin/blob/master/lib/rails_admin/config.rb#L104

DEFAULT_AUTHORIZE
DEFAULT_CURRENT_METHOD
VERSION

Public Class Methods

authenticate_with(&block) click to toggle source
# File lib/blacksand.rb, line 30
def self.authenticate_with(&block)
  @authenticate = block if block
  @authenticate || DEFAULT_AUTHENTICATION
end
authorize_with(*args) click to toggle source
# File lib/blacksand.rb, line 40
def self.authorize_with(*args)
  extension = args.shift
  # 目前只支持 cancancan
  if extension.present? && extension == :cancancan
    @authorize = proc do
      @authorization_adapter = Blacksand::Cancancan.new(self)
    end

  elsif extension.present? && extension != :cancancan
    puts "Error: Authorization only supports cancancan"
  end

  @authorize || DEFAULT_AUTHORIZE
end
current_user_method(&block) click to toggle source
# File lib/blacksand.rb, line 35
def self.current_user_method(&block)
  @current_user = block if block
  @current_user || DEFAULT_CURRENT_METHOD
end
table_name_prefix() click to toggle source
# File lib/blacksand.rb, line 12
def self.table_name_prefix
end