module AWS::S3::ACL::S3Object::ClassMethods

Public Instance Methods

acl(name, bucket = nil, policy = nil) click to toggle source

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

# Fetch the acl for the 'kiss.jpg' object in the 'marcel' bucket
policy = S3Object.acl 'kiss.jpg', 'marcel'

# Modify the policy ...
# ...

# Send updated policy back to the S3 servers
S3Object.acl 'kiss.jpg', 'marcel', policy
    # File lib/aws/s3/acl.rb
554 def acl(name, bucket = nil, policy = nil)
555   # We're using the second argument as the ACL::Policy
556   if bucket.is_a?(ACL::Policy)
557     policy = bucket
558     bucket = nil
559   end
560 
561   bucket = bucket_name(bucket)
562   path   = path!(bucket, name) << '?acl'
563 
564   respond_with ACL::Policy::Response do
565     policy ? put(path, {}, policy.to_xml) : ACL::Policy.new(get(path).policy)
566   end
567 end