192 |
- |
1 |
polkit.addAdminRule(function(action, subject) {
|
|
|
2 |
//polkit.log('Starting pkla-admin-identities\n');
|
|
|
3 |
// Let exception, if any, propagate to the JS authority
|
|
|
4 |
var res = polkit.spawn(['/usr/bin/pkla-admin-identities']);
|
|
|
5 |
//polkit.log('Got "' + res.replace(/\n/g, '\\n') + '"\n');
|
|
|
6 |
if (res == '')
|
|
|
7 |
return null;
|
|
|
8 |
var identities = res.split('\n');
|
|
|
9 |
//polkit.log('Identities: ' + identities.join(',') + '\n');
|
|
|
10 |
if (identities[identities.length - 1] == '')
|
|
|
11 |
identities.pop()
|
|
|
12 |
//polkit.log('Returning: ' + identities.join(',') + '\n');
|
|
|
13 |
return identities;
|
|
|
14 |
});
|
|
|
15 |
|
|
|
16 |
polkit.addRule(function(action, subject) {
|
|
|
17 |
var params = ['/usr/bin/pkla-check-authorization',
|
|
|
18 |
subject.user, subject.local ? 'true' : 'false',
|
|
|
19 |
subject.active ? 'true' : 'false', action.id];
|
|
|
20 |
//polkit.log('Starting ' + params.join(' ') + '\n');
|
|
|
21 |
var res = polkit.spawn(params);
|
|
|
22 |
//polkit.log('Got "' + res.replace(/\n/g, '\\n') + '"\n');
|
|
|
23 |
if (res == '')
|
|
|
24 |
return null;
|
|
|
25 |
return res.replace(/\n$/, '');
|
|
|
26 |
});
|