a h@s,ddlZddlZejZGdddZdS)Nc@seZdZddZddZdS)polkitcCs4t|_|jjdddd|_tj|jdd|_dS)Nzorg.freedesktop.PolicyKit1z%/org/freedesktop/PolicyKit1/AuthorityT)Zfollow_name_owner_changesz$org.freedesktop.PolicyKit1.Authority)Zdbus_interface)dbusZ SystemBus_busZ get_object_proxyZ Interface _authority)selfr6/usr/lib/python3.9/site-packages/tuned/utils/polkit.py__init__s zpolkit.__init__c Cs |dus|durdSi}d}d}dd|if}z|j|||||d}Wntjjtfy}ztd|z|j |} WnBtjjy}z&td |WYd}~WYd}~d Sd}~00| dkrWYd}~d SWYd}~d SWYd}~n d}~00|rdSdS) zCheck authorization, return codes: 1 - authorized 2 - polkit error, but authorized with fallback method 0 - unauthorized -1 - polkit error and unauthorized by the fallback method -2 - polkit error and unable to use the fallback method NFzsystem-bus-namenamerzerror querying polkit: %sz-error using fallback authorization method: %s) rZCheckAuthorizationr exceptionsZ DBusException ValueErrorlogerrorrZ get_unix_user) rZsenderZ action_iddetailsflagsZcancellation_idZsubjectreteuidrrr check_authorization s&  "$zpolkit.check_authorizationN)__name__ __module__ __qualname__r rrrrr rsr)rZ tuned.logsZtunedZlogsgetrrrrrr s