Skip to content

Instantly share code, notes, and snippets.

@Satys
Created February 15, 2021 12:34
Show Gist options
  • Select an option

  • Save Satys/d5c4ae7067468c9f1b58b2fba6a954d4 to your computer and use it in GitHub Desktop.

Select an option

Save Satys/d5c4ae7067468c9f1b58b2fba6a954d4 to your computer and use it in GitHub Desktop.

Revisions

  1. Satys created this gist Feb 15, 2021.
    18 changes: 18 additions & 0 deletions get allowed permissions
    Original 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"]