Sha256: f39b379735ddce966dfceeadf9852e0e2d10f589cef8f29d6266e36b8ccb1c30
Contents?: true
Size: 1022 Bytes
Versions: 1
Compression:
Stored size: 1022 Bytes
Contents
require 'ixtlan/guard/abstract_session' <% if options[:remote_users] -%> require 'heartbeat' <% end -%> class Session < Ixtlan::Guard::AbstractSession include ActiveModel::Serializers::JSON include ActiveModel::Serializers::Xml def self.authenticate(login, password) User.authenticate(login, password) end def self.authenticate_remote(login, password) begin auth = Authentication.create(:login => login, :password => password) <% if options[:remote_users] -%> user = User.find_by_login(auth.login) if user.nil? heart = Heartbeat.new heart.beat User user = User.find_by_login(auth.login) raise "user #{auth.login} not found" unless user end <% else -%> user = User.new user.login = auth.login <% end -%> user.name = auth.name user.groups = auth.groups user rescue ActiveResource::ResourceNotFound result = User.new result.log = "access denied #{login}" # error message result end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
resty-generators-0.7.2 | lib/generators/resty/setup/templates/session.rb |