Server IP : 51.89.169.208 / Your IP : 3.15.0.151 Web Server : Apache System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : yellowleaf ( 1019) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/lib/python3.6/site-packages/pydbus/ |
Upload File : |
from gi.repository import GLib from collections import namedtuple AuthorizationResult = namedtuple("AuthorizationResult", "is_authorized is_challenge details") class MethodCallContext(object): def __init__(self, gdbus_method_invocation): self._mi = gdbus_method_invocation @property def bus(self): return self._mi.get_connection().pydbus @property def sender(self): return self._mi.get_sender() @property def object_path(self): return self._mi.get_object_path() @property def interface_name(self): return self._mi.get_interface_name() @property def method_name(self): return self._mi.get_method_name() def check_authorization(self, action_id, details, interactive=False): return AuthorizationResult(*self.bus.polkit_authority.CheckAuthorization(('system-bus-name', {'name': GLib.Variant("s", self.sender)}), action_id, details, 1 if interactive else 0, '')) def is_authorized(self, action_id, details, interactive=False): return self.check_authorization(action_id, details, interactive).is_authorized