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