Method: GoogleDrive::File#acl

Defined in:
lib/google_drive/file.rb

#acl(params = {}) ⇒ Object

Returns GoogleDrive::Acl object for the file.

With the object, you can see and modify people who can access the file. Modifications take effect immediately.

e.g.

# Dumps people who have access:
for entry in file.acl
  p [entry.type, entry.email_address, entry.role]
  # => e.g. ["user", "[email protected]", "owner"]
end

# Shares the file with new people:
# NOTE: This sends email to the new people.
file.acl.push(
    {type: "user", email_address: "[email protected]", role: "reader"})
file.acl.push(
    {type: "user", email_address: "[email protected]", role: "writer"})

# Changes the role of a person:
file.acl[1].role = "writer"

# Deletes an ACL entry:
file.acl.delete(file.acl[1])


249
250
251
252
# File 'lib/google_drive/file.rb', line 249

def acl(params = {})
  @acl = Acl.new(@session, self) if !@acl || params[:reload]
  @acl
end