
    =OOfB7                        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- ddl.m/Z/m0Z0 ddl1m2Z2  G d de3      Z4 G d de4      Z5 G d d e4      Z6 G d! d"e4      Z7 G d# d$e4      Z8y%)&
    )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)ADPersistentSearch)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                       e Zd Zd Zd Zd Zy)ExtendedOperationContainerc                     || _         y N)_connectionself
connections     V/var/www/premiumrankchecker/venv/lib/python3.12/site-packages/ldap3/extend/__init__.py__init__z#ExtendedOperationContainer.__init__5   s
    %    c                 |    t        j                  t        |       D cg c]  }|d   dk7  sd|z    c}      S c c}w )Nr   _z  )r   joindir)r'   elements     r)   __repr__z#ExtendedOperationContainer.__repr__8   s4    ||3t9ZPQ
VYHYTG^Z[[Zs   99c                 "    | j                         S r$   )r1   )r'   s    r)   __str__z"ExtendedOperationContainer.__str__;   s    }}r+   N)__name__
__module____qualname__r*   r1   r3    r+   r)   r"   r"   4   s    &\r+   r"   c                       e Zd ZddZ	 	 	 	 	 	 ddZeedddddddddfdZd	d
eee	dddddddddddfdZ
d	d	eee	dddddf
dZy)StandardExtendedOperationsNc                 J    t        | j                  |      j                         S r$   )r   r%   sendr'   controlss     r)   who_am_iz#StandardExtendedOperations.who_am_i@   s!    d&&  $	'r+   c           	      T    t        | j                  ||||||      j                         S r$   )r   r%   r;   )r'   userold_passwordnew_passwordhash_algorithmsaltr=   s          r)   modify_passwordz*StandardExtendedOperations.modify_passwordD   s4     d.."**,"&( )-	/r+   r   Fd   Tc                     |r!t        | j                  |||||||||	|
||      S t        | j                  |||||||||	|
||      S r$   )r   r%   r   )r'   search_basesearch_filtersearch_scopedereference_aliases
attributes
size_limit
time_limit
types_onlyget_operational_attributesr=   
paged_sizepaged_criticality	generators                 r)   paged_searchz'StandardExtendedOperations.paged_searchT   s{     )$*:*:*5*7*6*=*4*4*4*4*D*2*4*;= = ,D,<,<,7,9,8,?,6,6,6,6,F,4,6,=? ?r+    (objectclass=*)c                     d}|
r|dz  }|r|dz  }|r|dz  }|r|dz  }|rd}t        | j                  |||||||||	||||      S )Nr   r
   r         Fr    r%   )r'   rH   rI   rJ   rK   rL   rM   rN   r=   changes_onlyshow_additionsshow_deletionsshow_modificationsshow_dn_modificationsnotifications	streamingcallbackevents_types                     r)   persistent_searchz,StandardExtendedOperations.persistent_search   s    $ 1K1K1K 1KI 0 0 + - , 3 * * * ( , + - ) (* 	*r+   c                 F    t        | j                  ||||||||d d d |	|
      S r$   rZ   )r'   rH   rI   rJ   rK   rL   rM   rN   r=   ra   rb   s              r)   funnel_searchz(StandardExtendedOperations.funnel_search   s@       0 0 + - , 3 * * * ( $ $ $ ) (* 	*r+   r$   )NNNNNN)r4   r5   r6   r>   rE   r   r   rT   r	   r   rd   rf   r7   r+   r)   r9   r9   ?   s    '
 "%)%)'+!!%/& #*)5 $ ! ! %05" #',#*?Z ')(9'..9%3%&%&#''+)-)--104(,$(#'!+*\ #%$&#**5!/!"!"# %#*r+   r9   c                   d    e Zd ZddZddZddZddZddZddZddZ	dd	Z
dd
ZddZddZy)NovellExtendedOperationsNc                 J    t        | j                  |      j                         S r$   )r   r%   r;   r<   s     r)   get_bind_dnz$NovellExtendedOperations.get_bind_dn   s!    ))!##'46	*r+   c                 L    t        | j                  ||      j                         S r$   )r   r%   r;   )r'   r@   r=   s      r)   get_universal_passwordz/NovellExtendedOperations.get_universal_password   s$    '(8(8(,(0226$&	9r+   c                 N    t        | j                  |||      j                         S r$   )r   r%   r;   )r'   r@   rB   r=   s       r)   set_universal_passwordz/NovellExtendedOperations.set_universal_password   s)    '(8(8(,(4(02 37$&	9r+   c                 L    t        | j                  ||      j                         S r$   )r   r%   r;   )r'   	server_dnr=   s      r)   list_replicasz&NovellExtendedOperations.list_replicas   s$    D,,%$&&*df	-r+   c                 L    t        | j                  ||      j                         S r$   )r   r%   r;   )r'   partition_dnr=   s      r)   partition_entry_countz.NovellExtendedOperations.partition_entry_count   s$    "4#3#3#/#+--1TV	4r+   c                 N    t        | j                  |||      j                         S r$   )r   r%   r;   )r'   rp   rs   r=   s       r)   replica_infoz%NovellExtendedOperations.replica_info   s)    4++$'#% &*TV	,r+   c                 J    t        | j                  |      j                         S r$   )r   r%   r;   r<   s     r)   start_transactionz*NovellExtendedOperations.start_transaction   s!     0 0 (**.$&	1r+   c                 L    t        | j                  ||      j                         S r$   )r   r%   r;   )r'   commitr=   s      r)   end_transactionz(NovellExtendedOperations.end_transaction   s$    d..$&((,	/r+   c                 6    t        | j                  ||||      S N)
members_dn	groups_dnfixtransaction)r   r%   r'   membersgroupsr   r   s        r)   add_members_to_groupsz.NovellExtendedOperations.add_members_to_groups   s%    )$*:*:5<4:.16A	C 	Cr+   c                 6    t        | j                  ||||      S r}   )r   r%   r   s        r)   remove_members_from_groupsz3NovellExtendedOperations.remove_members_from_groups   s%    .t/?/?:A9?36;F	H 	Hr+   c                 6    t        | j                  ||||      S r}   )r   r%   r   s        r)   check_groups_membershipsz1NovellExtendedOperations.check_groups_memberships   s%    ,T-=-=8?7=149D	F 	Fr+   r$   NN)TN)TT)FT)r4   r5   r6   rj   rl   rn   rq   rt   rv   rx   r{   r   r   r   r7   r+   r)   rh   rh      s<    *9
9-
4
,1/
CHFr+   rh   c            	       V    e Zd Zdedddddddf	dZddZd Zdd	Zdd
Zde	eddfdZ
y)MicrosoftExtendedOperationsrV   NFTic                 B    t        | j                  |||||||||	|
      S )N)
	sync_basesync_filterrL   cookieobject_securityancestors_firstpublic_data_onlyincremental_values
max_lengthhex_guid)r   r%   )r'   r   r   rL   r   r   r   r   r   r   r   s              r)   dir_syncz$MicrosoftExtendedOperations.dir_sync	  s7     t''!*#.",$'6'6(8*<", (
* 
	*r+   c                 4    t        | j                  ||||      S r$   )r   r%   )r'   r@   rB   rA   r=   s        r)   rE   z+MicrosoftExtendedOperations.modify_password   s#    !$"2"2"&"."."*	, 	,r+   c                 .    t        | j                  |      S r$   )r   r%   )r'   r@   s     r)   unlock_accountz*MicrosoftExtendedOperations.unlock_account'  s     !1!1!%' 	'r+   c                 4    t        | j                  |||      S N)r~   r   r   )r   r%   r'   r   r   r   s       r)   r   z1MicrosoftExtendedOperations.add_members_to_groups+  s     '(8(83:28,/1 	1r+   c                 4    t        | j                  |||      S r   )r   r%   r   s       r)   r   z6MicrosoftExtendedOperations.remove_members_from_groups1  s     ,T-=-=8?7=146 	6r+   rU   c                 >    |rd}t        | j                  |||||      S )NF)r   r%   )r'   rH   rJ   rL   ra   rb   s         r)   rd   z-MicrosoftExtendedOperations.persistent_search7  s0     I!$"2"2"-".","+"*, 	,r+   r   )T)r4   r5   r6   r   r   rE   r   r   r   r   rd   r7   r+   r)   r   r     sN     /*!&!%"'$(&*.,'16 ')'.%3$(#',r+   r   c                       e Zd Zd Zy)ExtendedOperationsRootc                     t         j                  | |       t        | j                        | _        t        | j                        | _        t        | j                        | _        y r$   )	r"   r*   r9   r%   standardrh   novellr   	microsoftr&   s     r)   r*   zExtendedOperationsRoot.__init__J  sH    "++D*=243C3CD.t/?/?@4T5E5EFr+   N)r4   r5   r6   r*   r7   r+   r)   r   r   I  s    Gr+   r   N)9__doc__osr   rU   r   r   r   r	   microsoft.dirSyncr   microsoft.modifyPasswordr   microsoft.unlockAccountr   microsoft.addMembersToGroupsr   !microsoft.removeMembersFromGroupsr   microsoft.persistentSearchr   novell.partition_entry_countr   novell.replicaInfor   novell.listReplicasr   novell.getBindDnr   novell.nmasGetUniversalPasswordr   novell.nmasSetUniversalPasswordr   novell.startTransactionr   novell.endTransactionr   novell.addMembersToGroupsr   novell.removeMembersFromGroupsr   novell.checkGroupsMembershipsr   standard.whoAmIr   standard.modifyPasswordr   standard.PagedSearchr   r   standard.PersistentSearchr    objectr"   r9   rh   r   r   r7   r+   r)   <module>r      s   2  A A & 8 6 B L : = + - ' E E 5 1 A K H # 3 R 7 G*!; G*T<F9 <F~>,"< >,BG7 Gr+   