403 Forbidden


Disable Functions:
Path : /lib/python2.7/site-packages/slip/dbus/
File Upload :
Command :
Current File : //lib/python2.7/site-packages/slip/dbus/polkit.pyc

�
�i�Zc@s�dZddlZddlmZddlmZddddd	d
gZd�ZdZdefd
��YZ	de	ddd�Zdejfd��YZ
defd��YZe�Zd�Zeid�ZdS(smThis module contains convenience decorators and functions for using
PolicyKit with dbus services and clients.i����N(t	decorator(tmethod_call_no_timeouttrequire_authtenable_proxytAUTHFAIL_DONTCATCHtNotAuthorizedExceptiontAreAuthorizationsObtainabletIsSystemBusNameAuthorizedAsynccs�fd�}|S(s�Decorator for DBus service methods.

    Specify that a user needs a specific PolicyKit authorization `polkit_auth´
    to execute it.cs)t|d�st�t|d��|S(Nt_dbus_is_methodt_slip_polkit_auth_required(thasattrtAssertionErrortsetattr(tmethod(tpolkit_auth(s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pytrequire_auth_decorator)s((RR((Rs4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyR#ssBorg.fedoraproject.slip.dbus.service.PolKit.NotAuthorizedException.cBseZRS((t__name__t
__module__(((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyR4scs�|dkst|�st��dtfksB�dksBt��dks`t��s`t��dks�t�t�s�t����fd��|dk	r�t�|�S�fd�}|SdS(s�Decorator for DBus proxy methods.

    Let's you (optionally) specify either a result value or an exception type
    and a callback which is returned, thrown or called respectively if a
    PolicyKit authorization doesn't exist or can't be obtained in the DBus
    mechanism, i.e. an appropriate DBus exception is thrown.

    An exception constructor may and a callback must accept an `action_id´
    parameter which will be set to the id of the PolicyKit action for which
    authorization could not be obtained.

    Examples:

    1) Return `False´ in the event of an authorization problem, and call
    `error_handler´:

        def error_handler(action_id=None):
            print "Authorization problem:", action_id

        class MyProxy(object):
            @polkit.enable_proxy(authfail_result=False,
                                 authfail_callback=error_handler)
            def some_method(self, ...):
                ...

    2) Throw a `MyAuthError´ instance in the event of an authorization problem:

        class MyAuthError(Exception):
            def __init__(self, *args, **kwargs):
                action_id = kwargs.pop("action_id")
                super(MyAuthError, self).__init__(*args, **kwargs)
                self.action_id = action_id

        class MyProxy(object):
            @polkit.enable_proxy(authfail_exception=MyAuthError)
            def some_method(self, ...):
                ...cs�y|||�SWn�tjk
r�}|j�}|jt�sG�n|tt�}�dk	rs�d|�n�dk	r�y�d|�}Wn��}nX|�n�tkr��n�SXdS(Nt	action_id(tdbust
DBusExceptiont
get_dbus_namet
startswithtAUTH_EXC_PREFIXtlentNoneR(tfunctptktetexc_nameRtaf_exc(tauthfail_callbacktauthfail_exceptiontauthfail_result(s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt
_enable_proxyds$
	cs
t�|�S(N(R(R(R#(s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pytdecorate�sN(RtcallableRRt
issubclasst	ExceptionR(RR"R!R R$((R#R R!R"s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyR7s'$!
cBseZdZdZd�ZRS(sqException which a DBus service method throws if an authorization
    required for executing it can't be obtained.sAorg.fedoraproject.slip.dbus.service.PolKit.NotAuthorizedExceptioncOs4|jjd||_tt|�j||�dS(Nt.(t	__class__t_dbus_error_nametsuperRt__init__(tselfRRR((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyR,�s(RRt__doc__R*R,(((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyR�stPolKitcBs�eZdZdZdZdZd
Zd
Zd
Z	d
Z
ed��Ze
d��Ze
d��Ze
d��Ze
d��Zd	�Zd
�Zd�Zeid�ZRS(s"Convenience wrapper around polkit.sorg.freedesktop.PolicyKit1s%/org/freedesktop/PolicyKit1/Authoritys$org.freedesktop.PolicyKit1.AuthoritycCsM||jkrItjrItjjtj�dt_dt_dt_ndS(N(t
_dbus_nameR/t_PolKit__bustremove_signal_receivert_PolKit__signal_receiverRt_PolKit__interface(tclstnamet	old_ownert	new_owner((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt_on_name_owner_changed�s
		cCsItjsBtj�t_tjjd|jdddd�t_ntjS(Nthandler_functiontsignal_nametNameOwnerChangedtdbus_interfacesorg.freedesktop.DBus(R/R1Rt	SystemBustadd_signal_receiverR9R3(R-((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt_bus�s		cCs%tjs|jj�t_ntjS(N(R/t_PolKit__bus_nameR@tget_unique_name(R-((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt	_bus_name�s	cCs[tjsTy1tj|jj|j|j�|j�t_WqTtj	k
rPqTXntjS(N(
R/R4Rt	InterfaceR@t
get_objectR0t
_dbus_patht_dbus_interfaceR(R-((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt
_interface�s	cCs
t|j�S(N(tboolRH(R-((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt_polkit_present�scCsN|jjdd�}tj|d�}y|j|�}Wn
d}nX|S(Nsorg.freedesktop.DBuss/org/freedesktop/DBus(R@RERRDtGetConnectionUnixUserR(R-tsystem_bus_namet
bus_objectt
bus_interfacetuid((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt__dbus_system_bus_name_uid�s	
cCsN|js
tS|jjdi|jd6f|idd�\}}}|pM|S(Nssystem-bus-nameR6it(RJtTrueRHtCheckAuthorizationRC(R-t
authorizationt
is_authorizedtis_challengetdetails((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt__authorization_is_obtainable�s		csG�js
tSt|t�r(|g}nt�fd�|t�}|S(Ncs|o�j|�S(N(t$_PolKit__authorization_is_obtainable(txty(R-(s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt<lambda>�s(RJRRt
isinstancet
basestringtreduce(R-tauthorizationst
obtainable((R-s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyR�s	c	
s�|js.�|dkp*|j|�dk�Sd}|rG|dO}n�fd�}|jjdi|d6f|||dd|d|d	t�dS(
Niics|\}}}�|�dS(N((targsRURVRW(t
reply_handler(s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pytreply_cb�sssystem-bus-nameR6RQRct
error_handlerttimeout(RJRt!_PolKit__dbus_system_bus_name_uidRHRSR(	R-RLRRcRet	challengeRWtflagsRd((Rcs4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyR�s	

N(RRR.R0RFRGRR4R1RAR3tclassmethodR9tpropertyR@RCRHRJRgRYRRRR(((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyR/�s"
	
		cCs
tj|�S(N(t__polkitR(R`((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyRscCstj||||||�S(N(RlR(RLRRcReRhRW((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyR
s(R.RRt	constantsRt__all__RRtobjectRRRRRR/RlRRRR(((s4/usr/lib/python2.7/site-packages/slip/dbus/polkit.pyt<module>s			On		

404 Not Found
[ LogOut ]