Sha256: 249db09f3e0cde4fb659b11d2181449ce18d424261a0b532cd8b4a3789336754

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

module Heirloom

  class ArtifactAuthorizer

    def initialize(args)
      @config = args[:config]
      @logger = args[:logger]
    end

    def authorize(args)
      id = args[:id]
      name = args[:name]
      public_readable = args[:public_readable]

      unless @public_readable
        @config.regions.each do |region|
          bucket = "#{@config.bucket_prefix}-#{region}"

          s3_acl = ACL::S3.new :config => @config,
                               :logger => @logger,
                               :region => region

          s3_acl.allow_read_acccess_from_accounts :key_name => id,
                                                  :key_folder => name,
                                                  :bucket => bucket
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heirloom-0.1.0 lib/heirloom/artifact/artifact_authorizer.rb
heirloom-0.0.9 lib/heirloom/artifact/artifact_authorizer.rb
heirloom-0.0.8 lib/heirloom/artifact/artifact_authorizer.rb