Class: Kadmin::Auth::UserStore
- Inherits:
-
Object
- Object
- Kadmin::Auth::UserStore
- Defined in:
- lib/kadmin/auth/user_store.rb
Instance Method Summary collapse
- #exists?(email) ⇒ Boolean
- #get(email) ⇒ Object
-
#initialize(path = nil) ⇒ UserStore
constructor
A new instance of UserStore.
- #set(email, user) ⇒ Object
Constructor Details
#initialize(path = nil) ⇒ UserStore
Returns a new instance of UserStore.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/kadmin/auth/user_store.rb', line 4 def initialize(path = nil) @store = {} path ||= Rails.root.join('config', 'admin_users.yml') if File.exist?(path) && File.readable?(path) definitions = YAML.load_file(path.to_s) create_organizations(definitions['organizations']) load_users(definitions['users']) else Rails.logger.warn("Can't read admin users auth file at #{path}. Auth might not work") end end |
Instance Method Details
#exists?(email) ⇒ Boolean
25 26 27 |
# File 'lib/kadmin/auth/user_store.rb', line 25 def exists?(email) @store.key?(email.to_s.downcase) end |
#get(email) ⇒ Object
17 18 19 |
# File 'lib/kadmin/auth/user_store.rb', line 17 def get(email) return @store[email.to_s.downcase] end |
#set(email, user) ⇒ Object
21 22 23 |
# File 'lib/kadmin/auth/user_store.rb', line 21 def set(email, user) @store[email.to_s.downcase] = user end |