Query and modify the Access Control List
These functions allow one to programmatically query and modify the access control list for a a Google document. These allows us to find out or specify who owns, can write, or read the document. We can also revoke permission.
setAccess(doc, ..., .perms = list(...), con = doc@connection) getAccess(doc, con = doc@connection) removeAccess(doc, who, con = doc@connection)
- the GoogleDocumentDescription object or the name of a document.
If this is just the name,
conmust be specified.
- name = value pairs where name gives the type of access being
granted and value is the identity of the person to whom it is being granted.
value is typically an email address or
- this provides an alternative way to specify the type-who pairs rather than ... whch is more convenient for calling this function programmatically rather than interactively.
- the authenticated Google connection. See
- the identity of the user for who the permission is to be removed.
This is an email address or
getAccessreturns a character vector giving the type-who pairs.
setAccessreturns the updated access list.
removeAccessreturns the result of the HTTP request to remove the permissions. See
For reasons I haven't got to the bottom of yet,
setAccess() can return a value that is different
from a subsequent call to getAccess(), yet
that is precisely the call at the end of setAccess() with
the same connection object!
con = getGoogleDocsConnection()
docs = getDocs(con)
setAccess(docs$foo, writer = 'email@example.com', reader = 'everyone')
owner writer reader
"firstname.lastname@example.org" "email@example.com" "everyone"