dbus_manager: fix polkit warning
Only warn that polkit is unavailable when a component attempts to use it to check a permission. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
a797dd0b50
commit
3b62ed4e4f
|
@ -67,15 +67,18 @@ class DbusManager:
|
||||||
"/org/freedesktop/PolicyKit1/Authority",
|
"/org/freedesktop/PolicyKit1/Authority",
|
||||||
"org.freedesktop.PolicyKit1.Authority")
|
"org.freedesktop.PolicyKit1.Authority")
|
||||||
except self.DbusError:
|
except self.DbusError:
|
||||||
self.server.add_warning(
|
self.polkit = None
|
||||||
"Unable to find DBus PolKit Interface, this suggests PolKit "
|
|
||||||
"is not installed on your OS.")
|
|
||||||
|
|
||||||
async def check_permission(self,
|
async def check_permission(self,
|
||||||
action: str,
|
action: str,
|
||||||
err_msg: str = ""
|
err_msg: str = ""
|
||||||
) -> bool:
|
) -> bool:
|
||||||
if self.polkit is None:
|
if self.polkit is None:
|
||||||
|
self.server.add_warning(
|
||||||
|
"Unable to find DBus PolKit Interface, this suggests PolKit "
|
||||||
|
"is not installed on your OS.",
|
||||||
|
"dbus_polkit"
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
ret = await self.polkit.call_check_authorization( # type: ignore
|
ret = await self.polkit.call_check_authorization( # type: ignore
|
||||||
|
|
Loading…
Reference in New Issue