관리-도구
편집 파일: polkit.cpython-36.pyc
3 �<�e� � @ s, d dl Z d dlZejj� ZG dd� d�ZdS )� Nc @ s e Zd Zdd� Zdd� ZdS )�polkitc C s4 t j� | _| jjdddd�| _t j| jdd�| _d S )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)�self� r �/usr/lib/python3.6/polkit.py�__init__ s zpolkit.__init__c C s� |dks|dkrdS i }d}d}dd|if}y| j j|||||�d }W n� tjjtfk r� } zhtjd| � y| jj |�} W n2 tjjk r� } ztjd | � dS d}~X nX | dkr�d S dS W Y dd}~X nX |r�dS dS ) z�Check 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 NF� � zsystem-bus-name�namer zerror querying polkit: %sz-error using fallback authorization method: %s� ������) r ZCheckAuthorizationr � exceptionsZ DBusException� ValueError�log�errorr Z get_unix_user) r ZsenderZ action_idZdetails�flagsZcancellation_idZsubject�ret�eZuidr r r �check_authorization s&