Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get LDAP attributes used for users
Message
De
21/06/2004 12:14:24
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00915644
Message ID:
00915689
Vues:
11
>>I want to get a list of the attributes used at a directory service (LDAPv3). Is there a way to do that (w/o checking user by user)?
>>Example :
>>Suppose only attributeA and attributeB are used for the majority of entries but few users also has attributeC and attributeD. How could I get a list as :
>>attributeA, B, C, D.
>>TIA
>
>Cetin,
>
>Does this help?
DEFINE CLASS ValidateUser AS Session OLEPUBLIC
>
>  FUNCTION ValidateUser(tcUser AS String,;
>    tcPassword AS String) OLEPUBLIC
>
>    LOCAL lcresult AS String,;
>      loName AS NameTranslate,;
>      lcAccount AS String, loLDAP AS LDAP,;
>      loLDAP2 AS LDAP,;
>      oErr AS Exception, a_memberof,;
>      lcUser AS String, lcCRLF As String
>    lcresult = ""
>    lcCRLF = CHR(13) + CHR(10)
>    DIMENSION a_memberof[1]
>    * Change domain to the current domain
>    lcUser = tcUser + '@domain.com'
>    loName = CREATEOBJECT('NameTranslate')
>    loName.InitEx(3, "", lcUser, "", tcPassword)
>    loName.Set(9, lcUser)
>    lcAccount = loName.Get(1)
>    IF NOT EMPTY(lcAccount) THEN
>      loLDAP = GETOBJECT("LDAP:")
>      TRY
>        loLDAP2 = loLDAP.OpenDSObject("LDAP://" +;
>           lcAccount, lcAccount, tcPassword, 2)
>      CATCH TO oErr
>        lcresult = oErr.Message
>      FINALLY
>        IF EMPTY(lcresult) THEN
>          a_memberof = loLDAP2.GetEx("MemberOF")
>          * The array here will contain
>          * all the groups
>          * there are two valid parts to the IF..
>          IF ALEN(a_memberof, 1) > 0 AND;
>              NOT EMPTY(a_memberof[1]) THEN
>            lcresult = "Yes"
>          ELSE
>            lcresult = "No"
>          ENDIF
>        ENDIF
>        STORE NULL TO loName, loLDAP, loLDAP2
>      ENDTRY
>    ENDIF
>    RETURN lcresult
>  ENDFUNC
>ENDDEFINE
I've broken up the formatting for readability. Drat! the parser's screwing up

BTW, FYI copied your code to use in conjunction with mine :)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform