Module: Aliyun::OSS::ACL::Bucket::ClassMethods

Defined in:
lib/aliyun/oss/acl.rb

Instance Method Summary collapse

Instance Method Details

#acl(name = nil, access_level = nil) ⇒ Object

The acl method is the single point of entry for reading and writing access control list policies for a given bucket.

# Fetch the acl for the 'marcel' bucket
policy = Bucket.acl 'marcel'

# Modify the policy ...
# Bucket.acl 'marcel', :public_read


54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/aliyun/oss/acl.rb', line 54

def acl(name = nil, access_level = nil)
  path = path(name) << '?acl'
  if access_level
    put(path, {:access => access_level})
    acl(name)
  else
    respond_with(Policy::Response) do 
      policy = get(path).policy 
      policy.has_key?('access_control_list') && policy['access_control_list']['grant'][0]
    end
  end
end