Ok i've understood the problem that a UDF must be one function.
For the link that does not work, it is the link for postprep zip that brings to a 404 censored page, but maybe i don't need it.
NTDOC, I can assure u the InGroup function is not reliable, and 4.20 is not a dependancy but the kix32 version used. 4.22 does not change anything on this point.
I modified the code to obtain a unique function.
Do what you want of it.
Bye.
Code:
Function MemberOf($Groupe, OPTIONAL $User)
;
; IF THE USER IS NOT SPECIFIED, CURRENT USER IS USED
If ($User = "")
$User = @USERID
EndIf
;
; RETRIEVES THE FULL QUALIFIED NAME OF THE GROUP
$LDAPGroupe = ""
$oLDAPGroupe = CreateObject("NameTranslate")
If Not(@ERROR)
$oLDAPGroupe.Init(3, "")
If Not(@ERROR)
$oLDAPGroupe.Set(3,"@DOMAIN\"+$Groupe)
If Not(@ERROR)
$LDAPGroupe = $oLDAPGroupe.Get(1)
EndIf
EndIf
EndIf
;
; CONNECTION TO THE GROUP
$oGroupe = GetObject("LDAP://" + $LDAPGroupe)
;
; BROWSE GROUP MEMBERS
If Not(@ERROR)
For Each $Objet In $oGroupe.Members
Select
;
; IF THE MEMBER IS A GROUP, RECURSIVELY GOES ON
Case $Objet.Class = "group"
$Result = MemberOf($Objet.cn, $User)
If ($Result = 1)
$MemberOf= 1
Return
EndIf
; IF THE MEMBER IS A USER, IS IT THE ONE ?
Case $Objet.Class = "user"
If ($Objet.samAccountName == @USERID)
$MemberOf= 1
Return
EndIf
EndSelect
Next
EndIf
$MemberOf = 0
EndFunction