PageSourceSearch

https://sgiam.com/components/logic/authLevels/authLevels.js

js sgiam.com collected 2026-09-29 11:22:59 UTC 1,274 bytes, 48 lines download raw bytes

1var authLevels = { 'Open'           : 0,
2                   'Optional'       : 0,
3                   'Anonymous'      : 0,
4                   'Created'        : 1,
5                   'Verified'       : 2,
6                   'Advisor'        : 3,
7                   'Admin'          : 4,
8                   'Root'           : 5,
9                   'Node'           : 1000 };
10                                   
11function roleForAuthLevel( authLevel )
12{
13    for( var role in authLevels )
14    {
15        if( authLevels[role] == authLevel ){ return role; }
16    }
17    
18    return "Unknown";
19}
20
21function atLeastAuthLevel( role, level )
22{
23    if( typeof level == "undefined" ){ level = me.auth; }
24    if( level >= authLevels[role] ){ return true; } return false;
25}
26
27function authDiv( level )
28{
29    var role = roleForAuthLevel( level );
30    return jQ("<div>", { 'class': "auth" + role + "Div" }).text( role );
31}
32
33function hasGrant( grant, acceptRoot )
34{
35    if( typeof acceptRoot == "undefined" ){ acceptRoot = true; }
36    
37    if( me.allGrants )
38    {
39        for( var g = 0; g < me.allGrants.length; g++ )
40        {
41            if( me.allGrants[g] == grant ){ return true; }
42        }
43    }
44
45    if( atLeastAuthLevel("Root") && acceptRoot ){ return true; }
46    
47    return false;
48}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.