Class: ICFS::UsersS3
Overview
Implements Users from AWS S3
Constant Summary
Constants inherited from Users
Instance Method Summary collapse
-
#flush(urg) ⇒ Boolean
Flush a user/role/group from a cache, if any.
-
#initialize(s3, bucket, prefix = nil) ⇒ UsersS3
constructor
New instance.
-
#read(urg) ⇒ Hash
Read a user/role/group.
-
#write(obj) ⇒ Object
Write a user/role/group.
Constructor Details
#initialize(s3, bucket, prefix = nil) ⇒ UsersS3
New instance
28 29 30 31 32 |
# File 'lib/icfs/users_s3.rb', line 28 def initialize(s3, bucket, prefix=nil) @s3 = s3 @bck = bucket @pre = prefix || ''.freeze end |
Instance Method Details
#flush(urg) ⇒ Boolean
Flush a user/role/group from a cache, if any
47 |
# File 'lib/icfs/users_s3.rb', line 47 def flush(urg); false; end |
#read(urg) ⇒ Hash
Read a user/role/group
53 54 55 56 57 58 59 |
# File 'lib/icfs/users_s3.rb', line 53 def read(urg) Items.validate(urg, 'User/Role/Group name'.freeze, Items::FieldUsergrp) json = @s3.get_object( bucket: @bck, key: _path(urg) ).body.read return JSON.parse(json) rescue return nil end |