Nextcloud version: 25
I am currently using OCC to configure permission for a specific user on a folder (inside a groupfolder):
occ groupfolders:permissions GFID --user THEUSER /pathx/THEUSER -- +read +write +delete +create -share
How can I do the same using the groupfolder API?
POST apps/groupfolders/folders/$folderId/groups/$groupId : Set the permissions a group has in a folder
← looks like only for group.
Thanks
@juliushaertl @MorrisJobke @icewind You guys are my only hope of getting an answer before tring to implement it myself (and hopefully creating a PR).
Replying to myself, took way too long to find this information. We can use webdav (including group & user). Here’s a basic example:
$propertyupdate = <<<EOD
<?xml version="1.0"?>
<d:propertyupdate xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns" xmlns:ocs="http://open-collaboration-services.org/ns">
<d:set>
<d:prop>
<nc:acl-list>
<nc:acl>
<nc:acl-mapping-type>user</nc:acl-mapping-type>
<nc:acl-mapping-id>anuser</nc:acl-mapping-id>
<nc:acl-mask>16</nc:acl-mask>
<nc:acl-permissions>15</nc:acl-permissions>
</nc:acl>
<nc:acl>
<nc:acl-mapping-type>group</nc:acl-mapping-type>
<nc:acl-mapping-id>agroup</nc:acl-mapping-id>
<nc:acl-mask>16</nc:acl-mask>
<nc:acl-permissions>15</nc:acl-permissions>
</nc:acl>
</nc:acl-list>
</d:prop>
</d:set>
</d:propertyupdate>
EOD;
try {
$this->client->request('PROPPATCH', 'https://' . config('NEXTCLOUDURL') . '/remote.php/dav/files/myuser/the/path', [
'auth' => ['myuser', 'password'],
'headers' => ['Content-Type' => 'application/xml'],
'body' => $propertyupdate
]);
} catch (RequestException $e) {
$exception = $e->hasResponse() ? (string) $e->getResponse()->getBody() : $e->getMessage();
}
1 Like