Created
February 15, 2021 12:34
-
-
Save Satys/d5c4ae7067468c9f1b58b2fba6a954d4 to your computer and use it in GitHub Desktop.
Revisions
-
Satys created this gist
Feb 15, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ //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"]