Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/landscape/ui/lib/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/landscape/ui/lib/polkit.pyc

ó
ÍÿŠTc@scddlZddlZddlZddlmZdZdejjfd„ƒYZd„Z	dS(iÿÿÿÿN(tGObjects/com.canonical.LandscapeClientSettings.configuretPolicyKitMechanismcBsAeZdZedd„Zd„Zd„Zd„Zd„Z	RS(sÉ
    L{PolicyKitMechanism} is a specialised L{dbus.service.Object} which
    provides PolicyKit authorization checks for a provided DBus bus name and
    object path.  Subclasses must therefore call l{__init__} here with their
    object path, bus name and an error class to be raised when permission
    escalation fails.

    @type object_path: string
    @param object_path: The object path to register the subclass with.
    @type bus_name: dbus.service.BusName
    @param bus_name: The L{BusName} to the register the subclass with.
    @type permission_error: dbus.DBusException
    @param permission_error: A L{dbus.DBusException} to be raised when
        PolicyKit authorisation fails for the client.
    cCsDtt|ƒj|||ƒ||_d|_d|_||_dS(N(tsuperRt__init__tpermission_errortNonet	dbus_infotpolkittbypass(tselftobject_pathtbus_nameRRtconn((s;/usr/lib/python2.7/dist-packages/landscape/ui/lib/polkit.pyRs
			c	Cs¼|jrtddfStjtjƒjddtƒdƒ}ditj|ddƒd6tj	d	ddƒd
6f}|}idd6}tjdƒ}d}|j
|||||dd
ƒS(sô
        Check that the process with id L{pid} is allowed, by policy to utilise
        the L{privilege }.  If the class was initialised with L{bypass}=True
        then just say it was authorised without checking (useful for testing).
        tBypasssorg.freedesktop.PolicyKit1s%/org/freedesktop/PolicyKit1/Authoritys$org.freedesktop.PolicyKit1.Authoritysunix-processt
variant_levelitpidis
start-timetttimeoutiN(RtTrueRtdbust	Interfacet	SystemBust
get_objecttFalsetUInt32tUInt64tCheckAuthorization(	R	Rt	privilegeRtsubjectt	action_idtdetailstflagstcancellation_id((s;/usr/lib/python2.7/dist-packages/landscape/ui/lib/polkit.pyt_get_polkit_authorization%s(	
		
cCsF|jdkr6tj|jddtƒdƒ|_n|jj|ƒS(s6
        Get the process ID of the L{sender}.
        sorg.freedesktop.DBuss/org/freedesktop/DBus/BusN(RRRRRRtGetConnectionUnixProcessID(R	tsenderR((s;/usr/lib/python2.7/dist-packages/landscape/ui/lib/polkit.pyt
_get_peer_pid@s
	cCs|dko|dkS(sX
        Check if this is a local call, implying it is within a secure context.
        N(R(R	R#R((s;/usr/lib/python2.7/dist-packages/landscape/ui/lib/polkit.pyt_is_local_callJscCs_|j||ƒrtS|j||ƒ}|j||ƒ\}}}|s[|j|ƒ‚ntS(s@
        Check if we are already in a secure context, and if not check if the
        policy associated with L{privilege} both exists and allows the peer to
        utilise it.  As a side effect, if escalation of privileges is required
        then this will occur and a challenge will be generated if needs be.
        (R%RR$R!R(R	R#RRtpeer_pidtis_autht_R((s;/usr/lib/python2.7/dist-packages/landscape/ui/lib/polkit.pyt_is_allowed_by_policyPs	N(
t__name__t
__module__t__doc__RRRR!R$R%R)(((s;/usr/lib/python2.7/dist-packages/landscape/ui/lib/polkit.pyRs		
	cCstjƒ}|jƒdS(sG
    Invoke a L{gobject.MainLoop} to process incoming DBus events.
    N(RtMainLooptrun(tmainloop((s;/usr/lib/python2.7/dist-packages/landscape/ui/lib/polkit.pytlistenas(
Rtdbus.servicet	dbus.glibt
gi.repositoryRtPOLICY_NAMEtservicetObjectRR0(((s;/usr/lib/python2.7/dist-packages/landscape/ui/lib/polkit.pyt<module>sV