Author: jreidinger Date: Wed Jul 2 10:36:02 2008 New Revision: 48753 URL: http://svn.opensuse.org/viewcvs/yast?rev=48753&view=rev Log: add exception for policykit fail Modified: branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py branches/tmp/lslezak/workshop/auth_dbus_layer/Makefile branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py Modified: branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py?rev=48753&r1=48752&r2=48753&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py (original) +++ branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py Wed Jul 2 10:36:02 2008 @@ -1,23 +1,33 @@ -import dbus +from dbus.exceptions import DBusException -class AuthRequiredException(dbus.exceptions.DBusException): +class AuthRequiredException(DBusException): def __init__(self, service=''): - dbus.exceptions.DBusException.__init__(self, "Authentification needed for : %s"%service) + DBusException.__init__(self, "Authentification needed for : %s"%service) def __doc__(): print "exception which is throwed when user must authentificate before call dbus method." __doc__ = staticmethod(__doc__) -class AccessDenied(dbus.exceptions.DBusException): +class AccessDenied(DBusException): def __init__(self, service=''): - dbus.exceptions.DBusException.__init__(self, "Policykit denied access to service: %s"%service) + DBusException.__init__(self, "Policykit denied access to service: %s"%service) def __doc__(): print "exception which is throwed when user cannot use this service." __doc__ = staticmethod(__doc__) +class AuthFailed(DBusException): + def __init__(self, service=''): + DBusException.__init__(self, "Policykit failed when authentificate service: %s"%service) + + def __doc__(): + print "exception which is throwed when policykit failed. This shouldn't happen." + + __doc__ = staticmethod(__doc__) + if __name__=="__main__": AuthRequiredException.__doc__() AccessDenied.__doc__() + AuthFailed.__doc__() Modified: branches/tmp/lslezak/workshop/auth_dbus_layer/Makefile URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/auth_dbus_layer/Makefile?rev=48753&r1=48752&r2=48753&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/auth_dbus_layer/Makefile (original) +++ branches/tmp/lslezak/workshop/auth_dbus_layer/Makefile Wed Jul 2 10:36:02 2008 @@ -1,2 +1,5 @@ polkitbind.so: polkit.c gcc -fPIC -rdynamic -L/lib64 -lpython2.5 -ldbus-1 -lpolkit -lpolkit-dbus -I/usr/include/python -I/usr/include/PolicyKit -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -shared -o polkitbind.so polkit.c + +install: AuthException.py auth_layer_service.py polkitbind.so polkitwrapper.py + cp $? /usr/lib64/python/site-packages/ Modified: branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py?rev=48753&r1=48752&r2=48753&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py (original) +++ branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py Wed Jul 2 10:36:02 2008 @@ -13,6 +13,8 @@ raise AuthException.AccessDenied(name) elif result==-2: raise AuthException.AuthRequiredException(name) + elif result==-1: + raise AuthException.AuthFailed(name) return result def __doc__(): -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org