Mailinglist Archive: yast-commit (1535 mails)

< Previous Next >
[yast-commit] <rest-service> master : Use NoPermissionException in the YastService calls too instead
  • From: Duncan Mac-Vicar P <dmacvicar@xxxxxxx>
  • Date: Wed, 28 Oct 2009 13:56:35 +0100
  • Message-id: <E1N386d-0007ds-Pz@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit d9a87be792454aa8cf33f51adea32ed99ae30ae9
Author: Duncan Mac-Vicar P <dmacvicar@xxxxxxx>
Date: Wed Oct 28 13:56:02 2009 +0100

Use NoPermissionException in the YastService calls too instead
of a own exception which ends as Internal Server Error in the client
---
webservice/lib/exceptions.rb | 1 +
webservice/lib/yast_service.rb | 16 +++-------------
2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/webservice/lib/exceptions.rb b/webservice/lib/exceptions.rb
index 64f7825..a09fe64 100644
--- a/webservice/lib/exceptions.rb
+++ b/webservice/lib/exceptions.rb
@@ -70,6 +70,7 @@ class NoPermissionException < BackendException
xml.description "Permission to allow #{@permission} is not available for
user #{@user}"
xml.permission @permission
xml.user @user
+ xml.bug false
end
end
end
diff --git a/webservice/lib/yast_service.rb b/webservice/lib/yast_service.rb
index 968e16d..80d2d54 100644
--- a/webservice/lib/yast_service.rb
+++ b/webservice/lib/yast_service.rb
@@ -1,14 +1,4 @@
-
-class PolkitUnauthorizedError < Exception
-
- attr_reader :actionid,
- :result
-
- def initialize(actionid, result)
- @actionid = actionid
- @result = result
- end
-end
+require 'exceptions'

class YastService
require "dbus"
@@ -72,8 +62,8 @@ class YastService
if dbe.dbus_message.error_name ==
'org.freedesktop.PolicyKit.Error.NotAuthorized' && dbe.dbus_message.params.size
== 1
parms = dbe.dbus_message.params[0].split(' ')

- # throw a PolicyKit exception instead of the DBus exception
- raise PolkitUnauthorizedError.new(parms[0], parms[1])
+ # throw a PolicyKit exception instead of the DBus exception
+ raise NoPermissionException.new(parms[0], ENV['USER'])
end

# rethrow other DBus Errors
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages