3 Yd@s,ddlZddlZejjZGdddZdS)Nc@seZdZddZddZdS)polkitcCs4tj|_|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)selfr/usr/lib/python3.6/polkit.py__init__s zpolkit.__init__c Cs|dks|dkrdSi}d}d}dd|if}y|jj|||||d}Wntjjtfk r}zhtjd|y|jj |} Wn2tjjk r}ztjd |d Sd}~XnX| dkrd Sd SWYdd}~XnX|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_idZdetailsflagsZcancellation_idZsubjectreteZuidrrr check_authorization s&  zpolkit.check_authorizationN)__name__ __module__ __qualname__r rrrrr rsr)rZ tuned.logsZtunedZlogsgetrrrrrr s