LABS
where would you be without your data?â„¢
Permission Codes in the MySQL OwnCloud DB
As you may notice, in the MySQL OwnCloud DB, there's a "permissions" value. This value determines the access to the item being shared.
This is bit-based pattern. That is, when you take the value of "permissions" and convert it into a line of bits, each bit represents an access value.
Example:
The value 9 is the value you get from giving read, and delete access.
9 in binary:
1001
The first bit (2^0=1) represents read, and the 4th bit represents delete. (2^3=4)
​
As of OwnCloud 4.5 these values are:
read = 1 (or 2^0)
update = 2 (or 2^1)
create = 4 (or 2^2)
delete = 8 (or 2^3)
share = 16 (or 2^4)

NOTE: What about rename access? In OwnCloud 4.5, "Update" permissions is all that's needed to rename files in the web based interface.

Here's some sample code to work with the access permissions in VB.NET:​
Enum AccessBitCodes As UInteger
Read = 1
Update = 2
Create = 4
Delete = 8
Share = 16
End Enum

Public Function CheckAccessStringForBit(ByVal AccessValue As Integer, ByVal BitMaskCode As AccessBitCodes)
If AccessValue = 0 Then
Return False
End If
'Convert to unsigned integer
Dim BitInteger As UInteger = Convert.ToUInt32(AccessValue)
If BitInteger And BitMaskCode Then
Return True
Else
Return False
End If
End Function