You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an example on how we could see whether someone has the permission to perform a certain action.
Definitions
00000000 = 0 = NO PERMISSIONS
00000001 = 1 = READ OWN PROFILE
00000010 = 2 = WRITE OWN PROFILE
00000100 = 4 = READ ALL STUDENT'S PROFILES
00001000 = 8 = WRITE ALL STUDENT'S PROFILES
00010000 = 16 = READ ALL PROFILES
00100000 = 32 = WRITE ALL PROFILES
01000100 = 64 = CREATE NEW PROFILES
10000000 = 128 = DELETE PROFILES
Note: these are just examples
Calculation
To check whether a user has the permission to perform a certain action, you do the following: USER_PERMISSION_INTEGER | PERMISSION_TO_CHECK === USER_PERMISSION_INTEGER
Example
User has the permission to read and write it's own profile USER_PERMISSION_INTEGER = 3 = 00000011
The user requests to see it's own profile so: PERMISSION_TO_CHECK = 1 = 00000001 USER_PERMISSION_INTEGER | PERMISSION_TO_CHECK === 3 = 00000011 | 00000001 === 00000011
Discussion/documentation about how we want to handle the authorization for the REST API.
The text was updated successfully, but these errors were encountered: