Gabriel Espejo
Gabriel Espejo

Reputation: 1

Owncloud - Share files via API without delete permissions

How can I use the OwnCloud API or occ command to share a directory with an user, granting them read and write permissions, but restricting their ability to delete files they have uploaded?

I'm using a shell script with the following command:

curl -k -u "${ADMIN}:${ADMIN_PASS}" -X POST ${OWNCLOUD_URL}/ocs/v2.php/apps/files_sharing/api/v1/shares" -d path="/${username}/share_dir"
    -d shareType=0
    -d shareWith="${username}"
    -d permissions=15

I've noticed in the documentation that the permissions are as follows:

However, when I try combinations without including permission 8, it doesn't work. If I give permission 4, for example, the user can't see the directory. And the combination 14 is interpreted as permission 1. The combination 15 gives permissions to delete as well.

Documentation: https://doc.owncloud.com/server/next/developer_manual/core/apis/ocs-share-api.html#create-a-new-share

Upvotes: 0

Views: 40

Answers (0)

Related Questions