MMCT TEAM
Server IP : 103.191.208.50  /  Your IP : 216.73.216.226
Web Server : LiteSpeed
System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64
User : celkcksm ( 1031)
PHP Version : 5.6.40
Disable Function : show_source, system, shell_exec, passthru, exec
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/../lib/python3.6/site-packages/pydbus/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/../lib/python3.6/site-packages/pydbus/method_call_context.py
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

MMCT - 2023