1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[google|storage] fixes related to differences between s3 and google storage acl

This commit is contained in:
geemus 2010-11-05 15:31:31 -07:00
parent 93b8d32845
commit f73aa1f132
3 changed files with 18 additions and 16 deletions

View file

@ -65,7 +65,7 @@ module Fog
requires :key
options = {}
if @acl
options['x-amz-acl'] = @acl
options['x-goog-acl'] = @acl
end
if @location
options['LocationConstraint'] = @location

View file

@ -84,7 +84,7 @@ module Fog
Formatador.display_line("[yellow][WARN] options param is deprecated, use acl= instead[/] [light_black](#{caller.first})[/]")
end
if @acl
options['x-amz-acl'] ||= @acl
options['x-goog-acl'] ||= @acl
end
if content_type
options['Content-Type'] = content_type

View file

@ -6,35 +6,37 @@ module Fog
class AccessControlList < Fog::Parsers::Base
def reset
@in_access_control_list = false
@grant = { 'Grantee' => {} }
@in_entries = false
@entry = { 'Scope' => {} }
@response = { 'Owner' => {}, 'AccessControlList' => [] }
end
def start_element(name, attrs = [])
super
if name == 'AccessControlList'
@in_access_control_list = true
case name
when 'Entries'
@in_entries = true
when 'Scope'
key, value = attrs
@entry['Scope'][key] = value
end
end
def end_element(name)
case name
when 'AccessControlList'
@in_access_control_list = false
when 'Grant'
@response['AccessControlList'] << @grant
@grant = { 'Grantee' => {} }
when 'Entries'
@in_entries = false
when 'Entry'
@response['AccessControlList'] << @entry
@entry = { 'Scope' => {} }
when 'DisplayName', 'ID'
if @in_access_control_list
@grant['Grantee'][name] = @value
if @in_entries
@entry['Scope'][name] = @value
else
@response['Owner'][name] = @value
end
when 'Permission'
@grant[name] = @value
when 'URI'
@grant['Grantee'][name] = @value
@entry[name] = @value
end
end