Class: Heirloom::Authorizer
- Inherits:
-
Object
- Object
- Heirloom::Authorizer
- Includes:
- Utils::Email
- Defined in:
- lib/heirloom/archive/authorizer.rb
Instance Method Summary collapse
- #authorize(args) ⇒ Object
-
#initialize(args) ⇒ Authorizer
constructor
A new instance of Authorizer.
Methods included from Utils::Email
Constructor Details
#initialize(args) ⇒ Authorizer
Returns a new instance of Authorizer.
7 8 9 10 11 12 |
# File 'lib/heirloom/archive/authorizer.rb', line 7 def initialize(args) @config = args[:config] @name = args[:name] @id = args[:id] @logger = @config.logger end |
Instance Method Details
#authorize(args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/heirloom/archive/authorizer.rb', line 14 def (args) @accounts = args[:accounts] regions = args[:regions] return false unless validate_format_of_accounts @logger.info "Authorizing #{@accounts.join(', ')}." key_name = reader.key_name regions.each do |region| bucket = reader.get_bucket :region => region s3_acl = ACL::S3.new :config => @config, :region => region s3_acl.allow_read_access_from_accounts :key_name => key_name, :key_folder => @name, :accounts => @accounts, :bucket => bucket end @logger.info "Authorization complete." true end |