B
    ß%Q[…1  ã               @   sp  d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z-m.Z. ddl/m0Z0 G dd„ de1ƒZ2G dd„ de2ƒZ3G dd„ de2ƒZ4G d d!„ d!e2ƒZ5G d"d#„ d#e2ƒZ6d$S )%Ú
é    )Úlinesepé   )ÚSUBTREEÚDEREF_ALWAYSÚALL_ATTRIBUTESÚDEREF_NEVERé   )ÚDirSync)Úad_modify_password)Úad_unlock_account)Úad_add_members_to_groups)Úad_remove_members_from_groups)ÚPartitionEntryCount)ÚReplicaInfo)ÚListReplicas)Ú	GetBindDn)ÚNmasGetUniversalPassword)ÚNmasSetUniversalPassword)ÚStartTransaction)ÚEndTransaction)Úedir_add_members_to_groups)Úedir_remove_members_from_groups)Úedir_check_groups_memberships)ÚWhoAmI)ÚModifyPassword)Úpaged_search_generatorÚpaged_search_accumulator)ÚPersistentSearchc               @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚExtendedOperationContainerc             C   s
   || _ d S )N)Ú_connection)ÚselfÚ
connection© r#   úXC:\Users\HIRONO~1\AppData\Local\Temp\pip-install-6i93dh7p\ldap3\ldap3\extend\__init__.pyÚ__init__4   s    z#ExtendedOperationContainer.__init__c             C   s   t  dd„ t| ƒD ƒ¡S )Nc             S   s    g | ]}|d  dkrd| ‘qS )r   Ú_z  r#   )Ú.0Úelementr#   r#   r$   ú
<listcomp>8   s    z7ExtendedOperationContainer.__repr__.<locals>.<listcomp>)r   ÚjoinÚdir)r!   r#   r#   r$   Ú__repr__7   s    z#ExtendedOperationContainer.__repr__c             C   s   |   ¡ S )N)r,   )r!   r#   r#   r$   Ú__str__:   s    z"ExtendedOperationContainer.__str__N)Ú__name__Ú
__module__Ú__qualname__r%   r,   r-   r#   r#   r#   r$   r   3   s   r   c               @   sj   e Zd Zddd„Zddd„Zeeddddddddd	fd
d„Zddeee	dddd	d	d	d	d	d	d	dfdd„Z
dS )ÚStandardExtendedOperationsNc             C   s   t | j|ƒ ¡ S )N)r   r    Úsend)r!   Úcontrolsr#   r#   r$   Úwho_am_i?   s    z#StandardExtendedOperations.who_am_ic             C   s   t | j||||||ƒ ¡ S )N)r   r    r2   )r!   ÚuserÚold_passwordÚnew_passwordZhash_algorithmZsaltr3   r#   r#   r$   Úmodify_passwordC   s    z*StandardExtendedOperations.modify_passwordr   Féd   Tc             C   sL   |r&t | j|||||||||	|
||ƒS t| j|||||||||	|
||ƒS d S )N)r   r    r   )r!   Úsearch_baseÚsearch_filterÚsearch_scopeÚdereference_aliasesÚ
attributesÚ
size_limitÚ
time_limitZ
types_onlyZget_operational_attributesr3   Z
paged_sizeZpaged_criticalityÚ	generatorr#   r#   r$   Úpaged_searchS   s6    z'StandardExtendedOperations.paged_searchÚ z(objectclass=*)c             C   s`   d}|
r|d7 }|r|d7 }|r(|d7 }|r4|d7 }|r<d}t | j|||||||||	||||ƒS )Nr   r	   r   é   é   F)r   r    )r!   r:   r;   r<   r=   r>   r?   r@   r3   Zchanges_onlyZshow_additionsZshow_deletionsZshow_modificationsZshow_dn_modificationsZnotificationsZ	streamingÚcallbackZevents_typer#   r#   r$   Úpersistent_search   s2    z,StandardExtendedOperations.persistent_search)N)NNNNNN)r.   r/   r0   r4   r8   r   r   rB   r   r   rG   r#   r#   r#   r$   r1   >   sD   
     
 r1   c               @   sz   e Zd Zddd„Zddd„Zddd„Zddd	„Zdd
d„Zddd„Zd dd„Z	d!dd„Z
d"dd„Zd#dd„Zd$dd„ZdS )%ÚNovellExtendedOperationsNc             C   s   t | j|ƒ ¡ S )N)r   r    r2   )r!   r3   r#   r#   r$   Úget_bind_dn®   s    z$NovellExtendedOperations.get_bind_dnc             C   s   t | j||ƒ ¡ S )N)r   r    r2   )r!   r5   r3   r#   r#   r$   Úget_universal_password²   s    z/NovellExtendedOperations.get_universal_passwordc             C   s   t | j|||ƒ ¡ S )N)r   r    r2   )r!   r5   r7   r3   r#   r#   r$   Úset_universal_password·   s    z/NovellExtendedOperations.set_universal_passwordc             C   s   t | j||ƒ ¡ S )N)r   r    r2   )r!   Ú	server_dnr3   r#   r#   r$   Úlist_replicas½   s    z&NovellExtendedOperations.list_replicasc             C   s   t | j||ƒ ¡ S )N)r   r    r2   )r!   Úpartition_dnr3   r#   r#   r$   Úpartition_entry_countÂ   s    z.NovellExtendedOperations.partition_entry_countc             C   s   t | j|||ƒ ¡ S )N)r   r    r2   )r!   rL   rN   r3   r#   r#   r$   Úreplica_infoÇ   s    z%NovellExtendedOperations.replica_infoc             C   s   t | j|ƒ ¡ S )N)r   r    r2   )r!   r3   r#   r#   r$   Ústart_transactionÍ   s    z*NovellExtendedOperations.start_transactionTc             C   s   t | j||ƒ ¡ S )N)r   r    r2   )r!   Úcommitr3   r#   r#   r$   Úend_transactionÑ   s    z(NovellExtendedOperations.end_transactionc             C   s   t | j||||d�S )N)Ú
members_dnÚ	groups_dnÚfixÚtransaction)r   r    )r!   ÚmembersÚgroupsrV   rW   r#   r#   r$   Úadd_members_to_groupsÖ   s
    z.NovellExtendedOperations.add_members_to_groupsc             C   s   t | j||||d�S )N)rT   rU   rV   rW   )r   r    )r!   rX   rY   rV   rW   r#   r#   r$   Úremove_members_from_groupsÝ   s
    z3NovellExtendedOperations.remove_members_from_groupsFc             C   s   t | j||||d�S )N)rT   rU   rV   rW   )r   r    )r!   rX   rY   rV   rW   r#   r#   r$   Úcheck_groups_membershipsä   s
    z1NovellExtendedOperations.check_groups_memberships)N)N)NN)N)N)N)N)TN)TT)TT)FT)r.   r/   r0   rI   rJ   rK   rM   rO   rP   rQ   rS   rZ   r[   r\   r#   r#   r#   r$   rH   ­   s   









rH   c            	   @   sN   e Zd Zdedddddddf	dd„Zddd	„Zd
d„ Zddd„Zddd„ZdS )ÚMicrosoftExtendedOperationsz(objectclass=*)NFTiÿÿÿc             C   s    t | j|||||||||	|
d�S )N)
Ú	sync_baseÚsync_filterr>   ÚcookieÚobject_securityÚancestors_firstÚpublic_data_onlyÚincremental_valuesÚ
max_lengthÚhex_guid)r
   r    )r!   r^   r_   r>   r`   ra   rb   rc   rd   re   rf   r#   r#   r$   Údir_syncí   s    z$MicrosoftExtendedOperations.dir_syncc             C   s   t | j||||ƒS )N)r   r    )r!   r5   r7   r6   r3   r#   r#   r$   r8     s
    z+MicrosoftExtendedOperations.modify_passwordc             C   s   t | j|ƒS )N)r   r    )r!   r5   r#   r#   r$   Úunlock_account  s    z*MicrosoftExtendedOperations.unlock_accountc             C   s   t | j|||d�S )N)rT   rU   rV   )r   r    )r!   rX   rY   rV   r#   r#   r$   rZ     s    z1MicrosoftExtendedOperations.add_members_to_groupsc             C   s   t | j|||d�S )N)rT   rU   rV   )r   r    )r!   rX   rY   rV   r#   r#   r$   r[     s    z6MicrosoftExtendedOperations.remove_members_from_groups)NN)T)T)	r.   r/   r0   r   rg   r8   rh   rZ   r[   r#   r#   r#   r$   r]   ì   s   

r]   c               @   s   e Zd Zdd„ ZdS )ÚExtendedOperationsRootc             C   s4   t  | |¡ t| jƒ| _t| jƒ| _t| jƒ| _d S )N)	r   r%   r1   r    ÚstandardrH   Znovellr]   Z	microsoft)r!   r"   r#   r#   r$   r%     s    zExtendedOperationsRoot.__init__N)r.   r/   r0   r%   r#   r#   r#   r$   ri     s   ri   N)7Ú__doc__Úosr   rC   r   r   r   r   Zmicrosoft.dirSyncr
   Zmicrosoft.modifyPasswordr   Zmicrosoft.unlockAccountr   Zmicrosoft.addMembersToGroupsr   Z!microsoft.removeMembersFromGroupsr   Znovell.partition_entry_countr   Znovell.replicaInfor   Znovell.listReplicasr   Znovell.getBindDnr   Znovell.nmasGetUniversalPasswordr   Znovell.nmasSetUniversalPasswordr   Znovell.startTransactionr   Znovell.endTransactionr   Znovell.addMembersToGroupsr   Znovell.removeMembersFromGroupsr   Znovell.checkGroupsMembershipsr   Zstandard.whoAmIr   Zstandard.modifyPasswordr   Zstandard.PagedSearchr   r   Zstandard.PersistentSearchr   Úobjectr   r1   rH   r]   ri   r#   r#   r#   r$   Ú<module>   s6   o?0