Kaydet (Commit) 9156d489 authored tarafından Bahadır Kandemir's avatar Bahadır Kandemir

Use policy kit 1.0

üst 7b62cc8e
...@@ -129,22 +129,17 @@ class Call: ...@@ -129,22 +129,17 @@ class Call:
raise AttributeError, "Package name required for non-async calls." raise AttributeError, "Package name required for non-async calls."
def queryPolicyKit(self, action): def queryPolicyKit(self, action):
if self.link.use_agent: bus = dbus.SessionBus()
bus = dbus.SessionBus() try:
try: obj = bus.get_object("org.freedesktop.PolicyKit1.AuthenticationAgent", "/")
obj = bus.get_object("org.freedesktop.PolicyKit.AuthenticationAgent", "/") except dbus.DBusException, exception:
except dbus.DBusException, exception: print exception
return False return False
iface = dbus.Interface(obj, "org.freedesktop.PolicyKit.AuthenticationAgent") iface = dbus.Interface(obj, "org.freedesktop.PolicyKit1.AuthenticationAgent")
try: try:
return iface.ObtainAuthorization(action, 0, os.getpid(), timeout=2**16-1) == 1 return iface.ObtainAuthorization(action, 0, os.getpid(), timeout=2**16-1) == 1
except: except dbus.DBusException, exception:
return False print exception
else:
os.environ["POLKIT_AUTH_FORCE_TEXT"] = "1"
ret = subprocess.call(["/usr/bin/polkit-auth", "--obtain", action])
if ret == 0:
return True
return False return False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment