Sha256: 1e3bfc526072ff7caa22aca75f6340b729a9d61bd4bcf22a4cb633df3d017335
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true require 'killbill_client' module Kaui class User < ApplicationRecord devise :killbill_authenticatable, :killbill_registerable # Managed by Devise attr_accessor :password # Called by Devise to perform authentication # Throws KillBillClient::API::Unauthorized on failure def self.find_permissions(options) do_find_permissions(options) end # Called by CanCan to perform authorization # Throws KillBillClient::API::Unauthorized on failure def permissions User.do_find_permissions session_id: kb_session_id end # Verify the Kill Bill session hasn't timed-out (ran as part of Warden::Proxy#set_user) def authenticated_with_killbill? subject = KillBillClient::Model::Security.find_subject session_id: kb_session_id subject.is_authenticated rescue Errno::ECONNREFUSED, KillBillClient::API::Unauthorized => _e false end def root? Kaui.root_username == kb_username end def self.do_find_permissions(options = {}) KillBillClient::Model::Security.find_permissions options end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
kaui-3.0.4 | app/models/kaui/user.rb |
kaui-3.0.2 | app/models/kaui/user.rb |
kaui-2.2.1 | app/models/kaui/user.rb |
kaui-3.0.1 | app/models/kaui/user.rb |