Sha256: 2dfab17d1d2d321c681daf14f827112534af257eec6cd35d8d22948bfc5de59e

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

class Session
  include ActiveModel::Serializers::JSON
  include ActiveModel::Serializers::Xml

  attr_accessor :permissions, :user

  def self.create(params = {})
    if Rails.application.config.respond_to? :remote_sso_url
      begin
        a = Authentication.create(:login => params[:login],
                                  :password => params[:password])
        result = new
        user = User.new
        user.login = a.login
        user.name = a.name
        user.groups = a.groups
        result.user = user
        result
      rescue ActiveResource::ResourceNotFound
        nil
      end
    else
      user = User.authenticate(params[:login], params[:password])
      if user
        result = new
        result.user = user
        result
      end
    end
  end

  def idle_session_timeout
    Configuration.instance.idle_session_timeout
  end

  def attributes
    {'idle_session_timeout' => idle_session_timeout, 'permissions' => permissions, 'user' => user}
  end

  def id
    ""
  end
end
Session.include_root_in_json = false
Session

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
resty-generators-0.7.3 lib/generators/resty/setup/templates/session.rb~
resty-generators-0.7.2 lib/generators/resty/setup/templates/session.rb~
resty-generators-0.7.1 lib/generators/resty/setup/templates/session.rb~
resty-generators-0.7.0 lib/generators/resty/setup/templates/session.rb~
resty-generators-0.6.0 lib/generators/resty/setup/templates/session.rb~