Sha256: 2d92dfc6f0359265a01fa74a4c98193288d2ae18b6b6dcf9cb6d13d8340ecc18
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module Vxod class Api def initialize(rack_app) @rack_app = rack_app end attr_reader :rack_app # Authorize user right to make action on object # # Check that user login and have right to make 'action' on 'object' # If not it redirects to login page def required(action = nil, object = nil) if user.nil? BackPath.new(rack_app).save(app.request_path) app.redirect(Vxod.config.login_path) else true end end def login_with_openid openid.login end def logout app.detele_auth_key app.redirect(Vxod.config.after_login_default_path) end # Save missing user data after openid registration def openid_save_user_data openid.save_user_data end # Return user for fill user data page def user_to_fill_data @user_to_fill_data ||= Db.user.find_by_auth_key(app.auth_key_for_fill_user_data) end # Current user def user @user ||= Db.user.find_by_auth_key(app.auth_key) end private def openid @openid ||= LoginWithOpenid.new(app) end def app @app ||= Vxod::App.new(rack_app) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vxod-0.0.2 | lib/vxod/api.rb |