Author: lslezak Date: Thu Mar 5 16:16:03 2009 New Revision: 55944 URL: http://svn.opensuse.org/viewcvs/yast?rev=55944&view=rev Log: - dbus_samba_export.py - use the authentication agent directly Modified: branches/tmp/lslezak/core/dbus/namespace_service/doc/dbus_samba_export.py Modified: branches/tmp/lslezak/core/dbus/namespace_service/doc/dbus_samba_export.py URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/core/dbus/namespace_service/doc/dbus_samba_export.py?rev=55944&r1=55943&r2=55944&view=diff ============================================================================== --- branches/tmp/lslezak/core/dbus/namespace_service/doc/dbus_samba_export.py (original) +++ branches/tmp/lslezak/core/dbus/namespace_service/doc/dbus_samba_export.py Thu Mar 5 16:16:03 2009 @@ -38,12 +38,16 @@ if len(parts) == 2: if re.match("auth_.*", parts[1]): print 'Authorization ' + parts[0] + ' is needed' + session_bus = dbus.SessionBus() + polkit_obj = session_bus.get_object('org.freedesktop.PolicyKit.AuthenticationAgent', '/'); + polkit_res = polkit_obj.ObtainAuthorization(parts[0], 0, os.getpid(), dbus_interface='org.freedesktop.PolicyKit.AuthenticationAgent') - if os.system('polkit-auth --obtain ' + parts[0]) == 0: - try: - result = samba.AddShare(share_name, {'path':directory, 'comment':'Exported directory ' + directory, 'read only':'Yes'}, dbus_interface='org.opensuse.YaST.Values'); - except dbus.exceptions.DBusException, e: - exit(1) + print 'Authorization obtained: ' + polkit_res + + try: + result = samba.AddShare(share_name, {'path':directory, 'comment':'Exported directory ' + directory, 'read only':'Yes'}, dbus_interface='org.opensuse.YaST.Values'); + except dbus.exceptions.DBusException, e: + exit(1) else: print 'PolicyKit error: ' + message exit(1) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org