class MSS::S3::AccessControlList

Represents an access control list for S3 objects and buckets. For example:

acl = AccessControlList.new
acl.grant(:full_control).
  to(:canonical_user_id => "8a6925ce4adf588a4f21c32aa379004fef")
acl.to_xml                   # => '<AccessControlPolicy>...'

You can also construct an AccessControlList from a hash:

AccessControlList.new(
  :owner => { :id => "8a6925ce4adf588a4f21c32aa379004fef" },
  :grants => [{
    :grantee => { :canonical_user_id => "8a6925ce4adf588a4f21c32aa379004fef" },
    :permission => :full_control,
  }]
)

@see ACLObject

@attr [AccessControlList::Owner] owner The owner of the access

control list.  You can set this as a hash, for example:
 acl.owner = { :id => '8a6925ce4adf588a4f21c32aa379004fef' }
This attribute is required when setting an ACL.

@attr [list of AccessControlList::Grant] grants The list of

grants.  You can set this as a list of hashes, for example:

    acl.grants = [{
      :grantee => { :canonical_user_id => "8a6925ce4adf588a4f21c32aa379004fef" },
      :permission => :full_control,
    }]

Public Instance Methods

element_name() click to toggle source

@api private

# File lib/mss/s3/access_control_list.rb, line 216
def element_name
  "AccessControlPolicy"
end
grant(permission) click to toggle source

Convenience method for constructing a new grant and adding it to the ACL.

@example

acl.grants.size # => 0
acl.grant(:full_control).to(:canonical_user_id => "8a6925ce4adf588a4f21c32aa379004fef")
acl.grants.size # => 1

@return [GrantBuilder]

# File lib/mss/s3/access_control_list.rb, line 251
def grant(permission)
  GrantBuilder.new(self, Grant.new(:permission => permission))
end
stag() click to toggle source

@api private

Calls superclass method MSS::S3::ACLObject#stag
# File lib/mss/s3/access_control_list.rb, line 211
def stag
  super()+" xmlns=\"http://s3.amazonmss.com/doc/2006-03-01/\""
end