[Owncloud] [OwnCloud] ownCloud file permission structure

Sampath Basnagoda sampathbasnagoda at gmail.com
Mon Jun 3 19:52:29 UTC 2013


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*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/owncloud/attachments/20130604/6fd2975a/attachment.html>


More information about the Owncloud mailing list