blob: 0e8bcfb13e99fa10e1389b90a75e350f1df87a66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/* -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- */
function Details() {
this.toString = function() {
var ret = "[Details";
for (var i in this) {
if (typeof this[i] != "function") {
if (typeof this[i] == "string")
ret += " " + i + "='" + this[i] + "'";
else
ret += " " + i + "=" + this[i];
}
}
ret += "]";
return ret;
};
};
function Subject() {
this.isInGroup = function(group) {
for (var n = 0; n < this.groups.length; n++) {
if (this.groups[n] == group)
return true;
}
return false;
};
this.toString = function() {
var ret = "[Subject";
for (var i in this) {
if (typeof this[i] != "function") {
if (typeof this[i] == "string")
ret += " " + i + "='" + this[i] + "'";
else
ret += " " + i + "=" + this[i];
}
}
ret += "]";
return ret;
};
};
polkit._adminRuleFuncs = [];
polkit.addAdminRule = function(callback) {this._adminRuleFuncs.push(callback);};
polkit._runAdminRules = function(action, subject, details) {
var ret = null;
for (var n = 0; n < this._adminRuleFuncs.length; n++) {
var func = this._adminRuleFuncs[n];
var func_ret = func(action, subject, details);
if (func_ret) {
ret = func_ret;
break
}
}
return ret.join(",");
};
polkit._ruleFuncs = [];
polkit.addRule = function(callback) {this._ruleFuncs.push(callback);};
polkit._runRules = function(action, subject, details) {
var ret = null;
for (var n = 0; n < this._ruleFuncs.length; 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._adminRuleFuncs = [];
this._ruleFuncs = [];
};
|