[Owncloud] [OwnCloud] ownCloud file permission structure
Jan Brenner
jan at brennerpack.de
Tue Jun 4 09:25:13 UTC 2013
Hi Sampath,
that's simple. You know the possible permissions and the corresponding numeric values. The numeric values are "powers of two".
READ = 2^0
UPDATE = 2^1
CREATE = 2^2
...
A permission-set is the sum of these values.
Examples:
*When I share a file with both Delete permission and Update permission, then value of the permission column is 11.
--> 8 (DELETE) + 2 (UPDATE) + 1 (READ) = 11
*When I share a file with only share permission (only 'share' check box is checked), then value of the permission column is 17
--> 16 (SHARE) + 1 (READ) = 17
Best
Jan
-----Ursprüngliche Nachricht-----
Von: Sampath Basnagoda <sampathbasnagoda at gmail.com>
Gesendet: Die 4 Juni 2013 10:52
An: owncloud at kde.org
Betreff: Re: [Owncloud] [OwnCloud] ownCloud file permission structure
Can Somebody please help me with this?
Thanks.
On Tue, Jun 4, 2013 at 1:22 AM, Sampath Basnagoda <sampathbasnagoda at gmail.com <mailto:sampathbasnagoda at gmail.com> > wrote:
Hi all,
I'm developing a new app for ownCloud and I need to understand existing ownCloud File permission structure for that.
I found that there are following CRUDS file permission constants defined in the code.
const PERMISSION_CREATE = 4;
const PERMISSION_READ = 1;
const PERMISSION_UPDATE = 2;
const PERMISSION_DELETE = 8;
const PERMISSION_SHARE = 16;
const FORMAT_NONE = -1;
const FORMAT_STATUSES = -2;
const FORMAT_SOURCES = -3;
Suppose, I share a file with someone with following different privileges combinations. Then an entry will be added to 'oc_share' table per each share. There is a column called 'permissions' in 'oc_share' table and I can't understand whether how does it get following values for permission column. I mean I can't understand the relationship.
*When I share a file with only share permission (only 'share' check box is checked), then value of the permission column is 17.
*When I share a file with only Delete permission (only 'Delete' check box is checked), then value of the permission column is 9.
*When I share a file with only Update permission (only 'Update' check box is checked), then value of the permission column is 3.
*When I share a file with both share permission and Delete permission, then value of the permission column is 25.
*When I share a file with both share permission and Update permission, then value of the permission column is 19.
*When I share a file with both Delete permission and Update permission, then value of the permission column is 11.
*When I share a file with All permissions (Update, Delete, Share), then value of the permission column is 27.
*When I share a file with All permissions (Update, Delete, Share), then value of the permission column is 27.
*When I share a file with none of the permissions, then value of the permission column is 1.
Can somebody please explain me how these values are calculated.
Thanks in advanced. Please let me know, if this not clear enough.
--
Sampath Basnagoda,
Undergraduate,
Department of Computer Science and Engineering,
University of Moratuwa,
Sri Lanka.
contacts - (+94)716779281
Web Site - sampathbasnagoda.blogspot.com <http://sampathbasnagoda.blogspot.com>
--
Sampath Basnagoda,
Undergraduate,
Department of Computer Science and Engineering,
University of Moratuwa,
Sri Lanka.
contacts - (+94)716779281
Web Site - sampathbasnagoda.blogspot.com <http://sampathbasnagoda.blogspot.com>
_______________________________________________
Owncloud mailing list
Owncloud at kde.org
https://mail.kde.org/mailman/listinfo/owncloud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/owncloud/attachments/20130604/9f9c5fca/attachment.html>
More information about the Owncloud
mailing list