HEX
Server: LiteSpeed
System: Linux shams.tasjeel.ae 5.14.0-611.5.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 08:09:09 EST 2025 x86_64
User: infowars (1469)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //usr/lib/python3.9/site-packages/ipalib/__pycache__/backend.cpython-39.opt-1.pyc
a

}�fl�@s�dZddlZddlZddlZddlmZddlmZmZm	Z	ddl
mZmZm
Z
e�e�ZGdd�dej�ZGdd	�d	e�ZGd
d�de�ZdS)z*
Base classes for all backed-end plugins.
�N)�plugable)�PublicError�
InternalError�CommandError)�context�
Connection�destroy_contextc@seZdZdZdS)�Backendz-
    Base class for all backend plugins.
    N)�__name__�
__module__�__qualname__�__doc__�rr�2/usr/lib/python3.9/site-packages/ipalib/backend.pyr	#sr	c@sReZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
ee
�ZdS)�Connectiblea$
    Base class for backend plugins that create connections.

    In addition to the nicety of providing a standard connection API, all
    backend plugins that create connections should use this base class so that
    `request.destroy_context()` can properly close all open connections.
    FcCs6t�||�|r|j|_nd|jtt|��f|_dS)Nz%s_%s)r	�__init__�name�id�str)�selfZapiZshared_instancerrrr2s
zConnectible.__init__cOs`tt|j�r(td�|j|jt��j���|j|i|��}t	t|jt
||j��t�
d|j�dS)z1
        Create thread-local connection.
        z%{0} is already connected ({1} in {2})zCreated connection context.%sN)�hasattrrr�	Exception�formatr�	threading�current_thread�create_connection�setattrr�
disconnect�logger�debug)r�args�kw�connrrr�connect9s��zConnectible.connectcOstd|j��dS)Nz%s.create_connection()��NotImplementedErrorr)rr r!rrrrJszConnectible.create_connectioncCsNtt|j�s(td�|j|jt��j���|��t	t|j�t
�d|j�dS)N�!{0} is not connected ({1} in {2})zDestroyed connection context.%s)rrrrrrrr�destroy_connection�delattrrr�rrrrrMs��zConnectible.disconnectcCstd|j��dS)Nz%s.destroy_connection()r$r)rrrr'ZszConnectible.destroy_connectioncCstt|j�S)zY
        Return ``True`` if thread-local connection on `request.context` exists.
        )rrrr)rrr�isconnected]szConnectible.isconnectedcCs6tt|j�s(td�|j|jt��j���tt|j�j	S)z1
        Return thread-local connection.
        r&)
rrr�AttributeErrorrrrr�getattrr"r)rrrZ
__get_conncs��zConnectible.__get_connN)F)
r
rrr
rr#rrr'r*Z_Connectible__get_conn�propertyr"rrrrr)s


rc@s&eZdZddd�Zdd�Zdd�ZdS)	�ExecutionerNcCsT|dur|tjd<|jjr0|jjj|ddd�n|jj��|durPtt	d|�dS)zA
        client_ip: The IP address of the remote client.
        NZ
KRB5CCNAME)�ccacheZ
size_limitZ
time_limit�	client_ip)
�os�environ�envZ	in_serverr	Zldap2r#Z	rpcclientrr)rr/r0rrr�create_contextus

�zExecutioner.create_contextcCs
t�dS)N)rr)rrrr�szExecutioner.destroy_contextc
Os�z�z2||jvrt|d��|j||i|��WWt�StyH�Yn@ty�}z(t�d|jjt	|��t
��WYd}~n
d}~00Wt�nt�0dS)N)rznon-public: %s: %s)ZCommandrrrrr�	exception�	__class__r
rr)r�_namer �options�errr�execute�s

	��zExecutioner.execute)NN)r
rrr4rr:rrrrr.ss
r.)r
Zloggingrr1ZipalibrZ
ipalib.errorsrrrZipalib.requestrrrZ	getLoggerr
rZPluginr	rr.rrrr�<module>s
J