
    =OOf                     F    d Z ddlmZmZ ddlmZmZmZmZ ddl	m
Z
 	 ddZy)
   )LDAPInvalidDnErrorLDAPOperationsErrorResult)SEQUENCE_TYPESMODIFY_DELETEBASEDEREF_NEVER)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 }n|}|D cg c]  }|j                          }}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 )aH  
    :param connection: a bound Connection object
    :param members_dn: the list of members to remove from groups
    :param groups_dn: the list of groups where members are to be removed
    :param fix: checks for group existence and existing 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
    Removes users-groups relations following the Activwe Directory rules: users are removed from groups' member attribute

    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_removeresult_error_paramskvs                      o/var/www/premiumrankchecker/venv/lib/python3.12/site-packages/ldap3/extend/microsoft/removeMembersFromGroups.pyad_remove_members_from_groupsr3      si    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);KLGMMOLL&3=eTdAdGee!.0@ AGH&&ug6F&&++&33F;	6&&22&,OAvq!'..Fm$	1&P#34s1Z[_rZraV4stt9S'R 9] FA0 Me  5ts)   H+H0!H5H: H:H?H?N)F)__doc__core.exceptionsr   r    r   r   r   r	   utils.dnr
   r3        r2   <module>r:      s$   2 M @ @  /4	Dr9   