module Sinatra::RbbtAuth::Helpers

Public Instance Methods

authorize!() click to toggle source
# File lib/rbbt/rest/common/users.rb, line 13
def authorize!
  return true if authorized?
  target_url = @uri
  Log.warn{ "Unauthorized access to #{target_url}" }
  session[:target_url] = target_url
  redirect to('/login')
end
authorized?() click to toggle source
# File lib/rbbt/rest/common/users.rb, line 9
def authorized?
  ! user.nil?
end
logout!() click to toggle source
# File lib/rbbt/rest/common/users.rb, line 21
def logout!
  session[:user] = nil
end
user() click to toggle source
# File lib/rbbt/rest/common/users.rb, line 25
def user
  session[:user]
end