Created
February 15, 2021 12:34
-
-
Save Satys/d5c4ae7067468c9f1b58b2fba6a954d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//pseudo mysql query | |
all_permissions = query("SELECT id, name FROM Permissions") | |
// it returns all_permissions = [ | |
[1, "start_class"], | |
[2, "end_class"], | |
[3, "submit_assignment"], | |
[4, "evaluate_assignment"] | |
] | |
allowed_permissions = [] | |
// pseudo code to evaluate allowed_permissions | |
// permissions_status = "0010" as in step 2 | |
for (i=0 -> permissions_status.length){ | |
if (permissions_status[i] === "1") { | |
allowed_permissions.push(all_permissions[i+1]); | |
// since index of string starts from 0 | |
} | |
} | |
// it returns allowed_permissions = ["submit_assignment"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment