Mailinglist Archive: yast-commit (883 mails)

< Previous Next >
[yast-commit] <rest-service> master : Use PolKit explictly
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Tue, 7 Jul 2009 17:05:11 +0200
  • Message-id: <E1MOCEl-0003Ks-O0@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 913bb311ffa5720ed0af93c65e8aeaa58942d7d1
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Tue Jul 7 17:05:11 2009 +0200

Use PolKit explictly
---
webservice/lib/yast_roles.rb | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/webservice/lib/yast_roles.rb b/webservice/lib/yast_roles.rb
index 20b6b3f..88f9d5e 100644
--- a/webservice/lib/yast_roles.rb
+++ b/webservice/lib/yast_roles.rb
@@ -1,13 +1,11 @@
module YastRoles

require 'polkit'
- include PolKit

private
def user_roles(user)
-
IO.foreach( USER_ROLES_CONFIG ) do |line|
- line = line.chomp
+ line.chomp!
next if line[0] == "#"
roles = line.split(/[\s,]+/)
return roles if ( roles.size > 1 and roles[0] == user )
@@ -22,15 +20,15 @@ public
return true if ENV["RAILS_ENV"] == "test"
return false if self.current_account==nil ||
self.current_account.login.size == 0

- if polkit_check( action, self.current_account.login) == :yes
+ if PolKit.polkit_check( action, self.current_account.login) == :yes
Rails.logger.debug "Action: #{action} User:
#{self.current_account.login} Result: ok"
return true
end
#checking roles
- roles = (defined?(session) && session && session['user_roles']) ?
session['services'] : user_roles(self.current_account.login)
+ roles = (defined?(session) && session && session['user_roles']) ?
session['services'] : user_roles(self.current_account.login)
roles.each do |role|
if ( role != self.current_account.login and
- polkit_check( action, role) == :yes)
+ PolKit.polkit_check( action, role) == :yes)
Rails.logger.debug "Action: #{action} User:
#{self.current_account.login} WITH role #{role} Result: ok"
return true
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages