5 params: [ 'username', 'password' ],
9 access: L.rpc.declare({
12 params: [ 'scope', 'object', 'function' ],
13 expect: { access: false }
18 return L.session.access('ubus', 'session', 'access');
21 startHeartbeat: function()
23 this._hearbeatInterval = window.setInterval(function() {
24 L.session.isAlive().then(function(alive) {
27 L.session.stopHeartbeat();
32 }, L.globals.timeout * 2);
35 stopHeartbeat: function()
37 if (typeof(this._hearbeatInterval) != 'undefined')
39 window.clearInterval(this._hearbeatInterval);
40 delete this._hearbeatInterval;
47 callAccess: L.rpc.declare({
53 callAccessCallback: function(acls)
55 L.session.aclCache = acls;
58 updateACLs: function()
60 return L.session.callAccess()
61 .then(L.session.callAccessCallback);
64 hasACL: function(scope, object, func)
66 var acls = L.session.aclCache;
68 if (typeof(func) == 'undefined')
69 return (acls && acls[scope] && acls[scope][object]);
71 if (acls && acls[scope] && acls[scope][object])
72 for (var i = 0; i < acls[scope][object].length; i++)
73 if (acls[scope][object][i] == func)