Skip to main content

Listing permissions

Each file or folder in Files.Warwick has an Atom Collection of their permissions, represented as an Atom feed of files and folders and the permissions on the current file or folder.

Sending a GET request to the Atom endpoint for the permissions returns all of the sub-folders and files (sub-folders appear first), followed by the permissions set on that file or folder:

mat@augustus:~$ curl -i -X GET -u cuscav
   "https://files.warwick.ac.uk/files/api/atom/permissions?account=mmannion&path=mmannion/Files/"
Enter host password for user 'cuscav':

HTTP/1.1 200 OK
Date: Tue, 05 Mar 2013 18:58:50 GMT
Content-Type: application/atom+xml;charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app"> xmlns:files="http://go.warwick.ac.uk/elab-schemas/files/atom"
  <title>My account - - Permissions</title>
  <link rel="self" 
    href="https://files.warwick.ac.uk/files/api/atom/permissions?account=mmannion&path=mmannion%2FFiles%2F" />
  <link rel="alternate" 
    href="https://files.warwick.ac.uk/mmannion/browse/" />
  <link rel="service" 
    href="https://files.warwick.ac.uk/files/api/atom/service" />
  <author>
    <name>Mathew Mannion</name>
  </author>
  <id>https://files.warwick.ac.uk/mmannion/browse/</id>
  <updated>2013-03-05T15:02:24.658Z</updated>
  <entry files:stereotype="folder">
    <title>My new folder name - Permissions</title>
    <link rel="collection" 
      href="https://files.warwick.ac.uk/files/api/atom/permissions?account=mmannion&path=mmannion%2FFiles%2FMy+new+folder+name%2F" />
    <link rel="alternate" 
      href="https://files.warwick.ac.uk/mmannion/browse/My+new+folder+name" />
    <id>https://files.warwick.ac.uk/mmannion/browse/My+new+folder+name</id>
    <updated>2013-03-05T15:02:24.658Z</updated>
    <published>2013-03-05T15:02:24.658Z</published>
    <app:edited>2013-03-05T15:02:24.658Z</app:edited>
    <author>
      <name>Mathew Mannion</name>
    </author>
    <summary type="text">My new folder name/</summary>
  </entry>
  ... other sub-folders ...
  <entry files:stereotype="file">
    <title>Exam Results.pdf</title>
    <link rel="collection" href="https://files.warwick.ac.uk/files/api/atom/permissions?account=mmannion&path=mmannion%2FFiles%2FExam+Results.pdf"/>
    <link rel="alternate" type="application/pdf" href="https://files.warwick.ac.uk/mmannion/files/Exam+Results.pdf"/>
    <id>https://files.warwick.ac.uk/mmannion/files/Exam+Results.pdf</id>
    <updated>2013-03-05T16:38:34.971Z</updated>
    <published>2013-03-05T16:38:35.023Z</published>
    <app:edited>2013-03-05T16:38:34.971Z</app:edited>
    <author>
      <name>Mathew Mannion</name>
    </author>
    <summary type="text">Exam Results.pdf</summary>
  </entry>
  ... other sub-files ...
  <entry files:stereotype="permission">
    <title>curef</title>
    <link rel="edit" href="https://files.warwick.ac.uk/files/api/atom/permission?account=mmannion&path=mmannion%2FFiles%2F&permission=ff8081813fcd1231013fcd2e960c0003"/>
    <link rel="collection" href="https://files.warwick.ac.uk/files/api/atom/permissions?account=mmannion&path=mmannion%2FFiles%2F"/>
    <link rel="alternate" type="application/pdf" href="https://files.warwick.ac.uk/mmannion/browse/"/>
    <id>urn:uuid:ff8081813fcd1231013fcd2e960c0003</id>
    <author>
      <name>Mathew Mannion</name>
    </author>
    <summary type="text">ADMIN for John Dale (curef)</summary>
    <files:activity>ADMIN</files:activity>
    <files:type>User</files:type>
  </entry>
  <entry files:stereotype="permission">
    <title>cuscav</title>
    <link rel="edit" href="https://files.warwick.ac.uk/files/api/atom/permission?account=mmannion&path=mmannion%2FFiles%2F&permission=ff80818121a6bd930121a6cdd321003e"/>
    <link rel="collection" href="https://files.warwick.ac.uk/files/api/atom/permissions?account=mmannion&path=mmannion%2FFiles%2F"/>
    <link rel="alternate" type="application/pdf" href="https://files.warwick.ac.uk/mmannion/browse/"/>
    <id>urn:uuid:ff80818121a6bd930121a6cdd321003e</id>
    <author>
      <name>Mathew Mannion</name>
    </author>
    <summary type="text">VIEW for Mathew Mannion (cuscav)</summary>
    <files:activity>VIEW</files:activity>
    <files:type>User</files:type>
  </entry>
  ... other permissions ...
</feed>  
  • Each <entry> has a files:stereotype attribute that can be either folder, file or permission
  • Files and folders have a link rel="collection" that points to the Atom feed representing the collection of files/sub-folders and permissions
  • Permissions have a link rel="edit" that can be used to get the Atom representation of a single permission, and delete the permission
  • We specify a Files.Warwick XML Schema at http://go.warwick.ac.uk/elab-schemas/files/atom - this allows us to get Files.Warwick-specific properties. These are always optional
  • The <title> of a Permission is the usercode or group name that it applies to
  • Permissions have two Files.Warwick specific properties:
    • files:activity - the activity this permission represents. This is always one of:
      • VIEW (browse and download);
      • EDIT (upload, edit and delete); or
      • ADMIN (grant sharing rights)
    • files:type - the type of permission, this is always one of:
      • User - an individual usercode
      • Group - a Warwick web group
      • Anyone - (VIEW only) anyone, whether logged in or not (the <title> is also set to Anyone)
      • Staff - (VIEW only) any member of Staff (the <title> is also set to Staff)
      • Students - (VIEW only) any Student (the <title> is also set to Students)