ref: refs/heads/network
commit 861e2ef4fe85cc94d34e5ce00464fdc822afde7e
Author: Klaus Kämpf
Date: Tue Sep 29 14:07:09 2009 +0200
Add comments
---
webservice/package/policyKit-rights.rb | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/webservice/package/policyKit-rights.rb b/webservice/package/policyKit-rights.rb
old mode 100644
new mode 100755
index e3e780d..c2a249b
--- a/webservice/package/policyKit-rights.rb
+++ b/webservice/package/policyKit-rights.rb
@@ -57,16 +57,21 @@ usage "--action parameter (show|grant|revoke) missing" unless action
begin
SuseString = "org.opensuse.yast"
if action == "grant"
+ # run "polkit-action" to list all registered policies
IO.popen( "polkit-action", 'r+' ) do |pipe|
loop do
break if pipe.eof?
l = pipe.read
+ # polkit-action prints one policy per line
policies = l.split("\n")
+ # now 'blindly' grant org.opensuse.yast.*
policies.each do |policy|
if policy.include? SuseString and not policy.include? ".scr"
STDOUT.puts "granting: #{policy}"
command = "polkit-auth --user " + user + " --grant " + policy
- system (command)
+ unless system (command)
+ STDERR.puts "#{command} failed !"
+ end
end
end
end
@@ -86,7 +91,9 @@ begin
if policy.include? SuseString and not policy.include? ".scr"
STDOUT.puts "revoking: #{policy}"
command = "polkit-auth --user " + user + " --revoke " + policy
- system (command)
+ unless system (command)
+ STDERR.puts "#{command} failed !"
+ end
end
end
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org