
    =OOf|                     H    d Z ddlmZmZmZmZ ddlmZmZ ddl	m
Z
 	 	 ddZy)
   )SEQUENCE_TYPES
MODIFY_ADDBASEDEREF_NEVER)LDAPInvalidDnErrorLDAPOperationsErrorResult)safe_dnc           	         t        |t              s|g}t        |t              s|g}| j                  r0|D cg c]  }t        |       }}|D cg c]  }t        |       }}d}|D ]  }|r| j	                  |dt
        t        dg      }	| j                  j                  s| j                  |	      \  }
}	n6| j                  j                  r|	\  }}	}
}n| j                  }
| j                  }	|	d   dk(  st        |dz         d|
d   d	   v r|
d   d	   d   ng }|D cg c]  }|j                          }}ng }t               }|D cg c]  }|j                         |vs| }}|rt         |f|d<   |s| j#                  ||      }	| j                  j                  s| j                  |	      \  }}	n*| j                  j                  r|	\  }}	}}n| j                  }	|	d   dk7  sd
}g d}|r3t%        |	j'                         D cg c]  \  }}||v s||f c}}       | S  | S c c}w c c}w c c}w c c}w c c}}w )a  
    :param connection: a bound Connection object
    :param members_dn: the list of members to add to groups
    :param groups_dn: the list of groups where members are to be added
    :param fix: checks for group existence and already assigned members
    :param raise_error: If the operation fails it raises an error instead of returning False
    :return: a boolean where True means that the operation was successful and False means an error has happened
    Establishes users-groups relations following the Active Directory rules: users are added to the member attribute of groups.
    Raises LDAPInvalidDnError if members or groups are not found in the DIT.
    Fz(objectclass=*)member)dereference_aliases
attributesdescriptionsuccessz
 not found    r   T)resultr   dnmessage)
isinstancer   check_namesr
   searchr   r   strategysyncget_responsethread_saferesponser   r   lowerdictr   modifyr	   items)
connection
members_dn	groups_dnfixraise_error	member_dngroup_dnerrorgroupr   r   _existing_memberselementchangesmember_to_addresult_error_paramskvs                      j/var/www/premiumrankchecker/venv/lib/python3.12/site-packages/ldap3/extend/microsoft/addMembersToGroups.pyad_add_members_to_groupsr3      sj     j.1 \
i0K	:DEYgi(E
E7@A8WX&A	AE &&&u.?[ft|s}&~F&&++#-#:#:6#B &&&22-3*Avx)22H'..F-(I5()=>>FNRZ[\R]^jRkFkx{<8Bqs?OPGPP!&0:fWgmmoUe>eff!+] ;GH&&ug6F&&++&33F;	6&&22&,OAvq!'..Fm$	1&P#34s1Z[_rZraV4stt9Q&P 9Y FA&  Q
 g  5ts)   H+H0H5H: H:H?H?N)TF)__doc__ r   r   r   r   core.exceptionsr   r	   utils.dnr
   r3        r2   <module>r:      s&   2 > = L  "&).	Cr9   