summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2012-05-21 11:03:50 -0400
committerDavid Zeuthen <davidz@redhat.com>2012-05-21 11:03:50 -0400
commit6f550da889c9ad313c9944888c8a263ac5e4e0f2 (patch)
tree6c4c00805ca527a014e891364afb92f5f832238c /src
parent89865529ec98067ba8eada3b59938204534de7b2 (diff)
downloadpolkit-6f550da889c9ad313c9944888c8a263ac5e4e0f2.tar.gz
Use addRule() and addAdminRule()
... as the man page already says. Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/polkitbackend/init.js36
-rw-r--r--src/polkitbackend/polkitbackendjsauthority.c6
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))