Developer:API permissions
From myExperiment
Contents |
Sharing permissions
As an interim measure, we allow the setting of public sharing options for resources uploaded via the API. At present, three basic sharing options are supported:
- Resource is private
- Resource can be viewed by the public
- Resource can be viewed and downloaded by the public
The remainder of the sharing options are available as normal from the website after the upload. By default, resources will be uploaded with no public sharing at all. Only the uploader will be able to view, download or edit the resource.
If you supply a permissions element when creating or updating a resource, then (for the present time) please use exactly one of the following three fragments. More will follow when the general sharing API is complete.
Option 1: Resource is private
<?xml version="1.0"?> <workflow> ... <permissions/> </workflow>
Option 2: Resource can be viewed by the public
<?xml version="1.0"?>
<workflow>
...
<permissions>
<permission>
<category>public</category>
<privilege type="view"/>
</permission>
</permissions>
</workflow>
Option 3: Resource can be viewed and downloaded by the public
<?xml version="1.0"?>
<workflow>
...
<permissions>
<permission>
<category>public</category>
<privilege type="view"/>
<privilege type="download"/>
</permission>
</permissions>
</workflow>
Implementation note
The current mapping from public privileges to share_mode/update_mode is as follows:
| Public privileges | share_mode | update_mode |
|---|---|---|
| (none) | 7 | 6 |
| view | 2 | 6 |
| view and download | 0 | 6 |
The current mapping from share_mode/update_mode to public privileges is as follows:
| share_mode | update_mode | Public privileges |
|---|---|---|
| 3,4,5,6,7,8 | n/a | (none) |
| 1,2 | n/a | view |
| 0 | n/a | view and download |
