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 requires :key
options = {} options = {}
if @acl if @acl
options['x-amz-acl'] = @acl options['x-goog-acl'] = @acl
end end
if @location if @location
options['LocationConstraint'] = @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})[/]") Formatador.display_line("[yellow][WARN] options param is deprecated, use acl= instead[/] [light_black](#{caller.first})[/]")
end end
if @acl if @acl
options['x-amz-acl'] ||= @acl options['x-goog-acl'] ||= @acl
end end
if content_type if content_type
options['Content-Type'] = content_type options['Content-Type'] = content_type

View file

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