setAgentAccess(resourceURL, webID, read, write = false, append = false, doAutoAuth = true)

The pods:setAgentAccess() action modifies the access modes (read, write, append) of a resource, resourceURL, for a specific agent, webID. pods:connectStorage() should be called at some point prior to using this action (pods:connectStorage() does not need to be called again if the pico engine is restarted).

The pods:setAgentAccess() action has the following parameters:

  • resourceURL — A required string parameter that informs the library which resource is to have its access modes (read, write, append) modified. The resource can be a folder or a file. This should be a full, absolute URL with an http scheme (e.g. for a folder: http://examplepodserver:org/podName/myPhotos/folder/, for a file: http://examplepodserver:org/podName/myPhotos/file.txt) and a folder does require a slash at the end. If a folder’s access modes are modified, only the folder’s access modes are modified and not the access modes of the contents of the folder.

  • webID — A required string parameter that informs the library which agent is to have its access modes modified. This should be a full, absolute URL with an http scheme (e.g. https://id.inrupt.com/username). 

  • read — A required boolean parameter that controls the read permission of the specified resource. When true, the webID will have the ability to view the resource. 

  • write — An optional boolean parameter that controls the write permission of the specified resource. When true, the webID will have the ability to add new data to the resource, and to change or remove existing data. 

  • append — An optional boolean parameter that controls the append permission of the specified resource. When true, the webID will have the ability to add new data to the resource. 

  • doAutoAuth — An optional boolean parameter that controls automatic authentication attempts. It defaults to true if nothing is passed in for it. When true, the library will check that the stored authentication token is valid if it exists, and if the token is not valid or the token does not exist, the library will attempt to automatically authenticate once.

Copyright Picolabs | Licensed under Creative Commons.