aw schriftzug.png aw logo 60x60.png

internal package Foswiki::Plugins::LdapGuiPlugin::LdapUtil

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

ClassMethod new ($errorObject)

Either gets an error object from outside or creates its own. Initializes itself

ldapSearch ( %args ) → $search

Performs a search with in %args specified arguments. Check $this→hasError or the associated $error object for errors afterwards or control the search object.

ObjectMethod ldapAddToGroup ( $bindDN, $password, \@groupDN, \%modifyHash ) → $boolean

Takes a dn, password, list of group dn and a modify hash, binds to the LDAP and modifys the groups in groupDN by adding the member defined in the hash.

Use this function to add a user to a list of groups.

returns 1 on success, 0 otherwise. so check the return value or $error→hasError for error checking.

ObjectMethod ldapAdd ( $user, $subtree, $password, $entry ) → $boolean

Adds a new entry to the LDAP DIT. For this action a user (bind DN) and password is needed. Returns true on success, false otherwise. Check $this-hasError on false return. Attention: this method does not check if you wand to use a proxy user, providing correct data is specified

ObjectMethod ldapConnect ( $dn , $password ) → $boolean

This is more or less the LDAPContrib connect() Difference is that the caller has to check if proxy users are used und to provide the correct dn and password

ObjectMethod ldapDisconnect ( ) → 1

basically like ldapContrib disconnect()

ObjectMethod isConnected() → $boolean

returns true if a connection to the LDAP server is established, false otherwise.

ObjectMethod init () → $boolean

Init starts _initObjectClasses and _initAttributes and returns true of both succeeded. The initialization is mostly about tool function and to easy the work with the attributes. This method is invoked in the constructor if the ldap schema of the server was retrieved and a first initial connect succeeded so in this case the object is already initialized. But you are able to initialize later manually too.

_initObjectClasses ( ) → $boolean

Initalizes some lookup hashes which could be retrieved later if the LDAP schema is defined.

_initAttributes ( ) → $boolean

Initalizes some lookup hashes which could be retrieved later if the LDAP schema is defined.

ObjectMethod isUniqueLdapAttribute ( $attributeName, $value ) → boolean

searches inside the userBase if the attributevalue for a specific attribute is already inside the LDAP returns true if it is already there, false otherwise and on failure (check if error)

ObjectMethod getLastNumberFromLDAP ( $attributeName, $minimum, $maximum ) → $number

gets the biggest positive value of the numerical attribute between a range for all userbase DN. do not call this on attributes which:
  • are not numerical
  • can be negative

ObjectMethod getUserDN ( $loginAttributeName, $login ) → $list

Example: If your users log in via uid you pass uid=someuser and the function returns a list of entries found in the userbase matching the filer = "uid=someuser"

ObjectMethod hasError ( )

see Foswiki::Plugins::LdapGuiPlugin::Error→hasError()

Topic revision: r1 - 2018-02-27, UnknownUser
This site is powered by FoswikiCopyright &© by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback