diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/polkitbackend/init.js | 36 | ||||
-rw-r--r-- | src/polkitbackend/polkitbackendjsauthority.c | 6 |
2 files changed, 23 insertions, 19 deletions
diff --git a/src/polkitbackend/init.js b/src/polkitbackend/init.js index ec6b7ae..cf6a65d 100644 --- a/src/polkitbackend/init.js +++ b/src/polkitbackend/init.js @@ -41,33 +41,37 @@ function Subject() { }; }; -polkit._administratorRuleFuncs = []; -polkit.addAdministratorRule = function(callback) {this._administratorRuleFuncs.push(callback);}; -polkit._runAdministratorRules = function(action, subject, details) { +polkit._adminRuleFuncs = []; +polkit.addAdminRule = function(callback) {this._adminRuleFuncs.push(callback);}; +polkit._runAdminRules = function(action, subject, details) { var ret = null; - for (var n = this._administratorRuleFuncs.length - 1; n >= 0; n--) { - var func = this._administratorRuleFuncs[n]; - ret = func(action, subject, details); - if (ret) + for (var n = this._adminRuleFuncs.length - 1; n >= 0; n--) { + var func = this._adminRuleFuncs[n]; + var func_ret = func(action, subject, details); + if (func_ret) { + ret = func_ret; break + } } return ret.join(","); }; -polkit._authorizationRuleFuncs = []; -polkit.addAuthorizationRule = function(callback) {this._authorizationRuleFuncs.push(callback);}; -polkit._runAuthorizationRules = function(action, subject, details) { +polkit._ruleFuncs = []; +polkit.addRule = function(callback) {this._ruleFuncs.push(callback);}; +polkit._runRules = function(action, subject, details) { var ret = null; - for (var n = this._authorizationRuleFuncs.length - 1; n >= 0; n--) { - var func = this._authorizationRuleFuncs[n]; - ret = func(action, subject, details); - if (ret) + for (var n = this._ruleFuncs.length - 1; n >= 0; n--) { + var func = this._ruleFuncs[n]; + var func_ret = func(action, subject, details); + if (func_ret) { + ret = func_ret; break + } } return ret; }; polkit._deleteRules = function() { - this._administratorRuleFuncs = []; - this._authorizationRuleFuncs = []; + this._adminRuleFuncs = []; + this._ruleFuncs = []; }; diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c index 849034a..8c1d189 100644 --- a/src/polkitbackend/polkitbackendjsauthority.c +++ b/src/polkitbackend/polkitbackendjsauthority.c @@ -851,13 +851,13 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA if (!JS_CallFunctionName(authority->priv->cx, authority->priv->js_polkit, - "_runAdministratorRules", + "_runAdminRules", 3, argv, &rval)) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), - "Error evaluating administrator rules"); + "Error evaluating admin rules"); goto out; } @@ -958,7 +958,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu if (!JS_CallFunctionName(authority->priv->cx, authority->priv->js_polkit, - "_runAuthorizationRules", + "_runRules", 3, argv, &rval)) |