Sha256: ffdaf0955ad1c812b33da0d36d63e62c63ec5b29eaf7fd252f9cdd3449658c7e

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

module Fog
  module Storage
    class AWS
      private
        def self.hash_to_acl(acl)
          data =
<<-DATA
<AccessControlPolicy>
  <Owner>
    <ID>#{acl['Owner']['ID']}</ID>
    <DisplayName>#{acl['Owner']['DisplayName']}</DisplayName>
  </Owner>
  <AccessControlList>
DATA

          acl['AccessControlList'].each do |grant|
            data << "    <Grant>\n"
            type = case grant['Grantee'].keys.sort
            when ['DisplayName', 'ID']
              'CanonicalUser'
            when ['EmailAddress']
              'AmazonCustomerByEmail'
            when ['URI']
              'Group'
            end
            data << "      <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"#{type}\">\n"
            data << "        <ID>#{grant['Grantee']['ID']}</ID>\n"
            data << "        <DisplayName>#{grant['Grantee']['DisplayName']}</DisplayName>\n"
            data << "      </Grantee>\n"
            data << "      <Permission>#{grant['Permission']}</Permission>\n"
            data << "    </Grant>\n"
          end
          
          data <<
<<-DATA
  </AccessControlList>
</AccessControlPolicy>
DATA
          data
        end
    end
  end      
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/hash_to_acl.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/hash_to_acl.rb
tag-fog-1.0.1 lib/fog/aws/requests/storage/hash_to_acl.rb
fog-1.0.0 lib/fog/aws/requests/storage/hash_to_acl.rb