Nextcloud PHP API (master)

ILDAPProvider

Interface ILDAPProvider

Tags
since
11.0.0
Attributes
#[Consumable]
$since: '11.0.0'

Table of Contents

Methods

clearCache()  : void
Clear the cache if a cache is used, otherwise do nothing.
clearGroupCache()  : void
Clear the cache if a cache is used, otherwise do nothing.
DNasBaseParameter()  : string
Convert a stored DN so it can be used as base parameter for LDAP queries.
dnExists()  : bool
Check whether a LDAP DN exists
findOneUserByAttributeValue()  : IUser|null
Search for a single user in LDAP based on one attribute.
getGroupDN()  : string
Translate a group id to LDAP DN.
getGroupLDAPConnection()  : Connection
Return a new LDAP connection resource for the specified group.
getLDAPBaseGroups()  : string
Get the LDAP base for groups.
getLDAPBaseUsers()  : string
Get the LDAP base for users.
getLDAPConnection()  : Connection
Return a new LDAP connection resource for the specified user.
getLDAPDisplayNameField()  : string
Get the LDAP attribute name for the user's display name
getLDAPEmailField()  : string
Get the LDAP attribute name for the email
getLDAPGroupMemberAssoc()  : string
Get the LDAP attribute name for the type of association between users and groups
getMultiValueUserAttribute()  : array<string|int, mixed>
Get a multi-value LDAP attribute for a nextcloud user
getUserAttribute()  : string|null
Get an LDAP attribute for a nextcloud user
getUserDN()  : string
Translate a user id to LDAP DN.
getUserName()  : string
Translate a LDAP DN to an internal user name.
sanitizeDN()  : array<string|int, mixed>|string
Sanitize a DN received from the LDAP server.

Methods

clearCache()

Clear the cache if a cache is used, otherwise do nothing.

public clearCache(string $uid) : void
Parameters
$uid : string

user id

Tags
since
11.0.0

clearGroupCache()

Clear the cache if a cache is used, otherwise do nothing.

public clearGroupCache(string $gid) : void
Parameters
$gid : string

group id

Tags
since
13.0.0

DNasBaseParameter()

Convert a stored DN so it can be used as base parameter for LDAP queries.

public DNasBaseParameter(string $dn) : string
Parameters
$dn : string

the DN

Tags
since
11.0.0
Return values
string

dnExists()

Check whether a LDAP DN exists

public dnExists(string $dn) : bool
Parameters
$dn : string

LDAP DN

Tags
since
11.0.0
Return values
bool —

whether the DN exists

findOneUserByAttributeValue()

Search for a single user in LDAP based on one attribute.

public findOneUserByAttributeValue(non-empty-string $attribute, non-empty-string $searchTerm) : IUser|null
Parameters
$attribute : non-empty-string
$searchTerm : non-empty-string
Tags
throws
MultipleUsersReturnedException

If multiple users have been found. The search attribute/term should not allow this.

since
34.0.0
Return values
IUser|null —

Returns a IUser if found in LDAP using the configured attribute and search term.

getGroupDN()

Translate a group id to LDAP DN.

public getGroupDN(string $gid) : string
Parameters
$gid : string

group id

Tags
since
13.0.0
Return values
string

getGroupLDAPConnection()

Return a new LDAP connection resource for the specified group.

public getGroupLDAPConnection(string $gid) : Connection
Parameters
$gid : string

group id

Tags
since
13.0.0
Return values
Connection

getLDAPBaseGroups()

Get the LDAP base for groups.

public getLDAPBaseGroups(string $uid) : string
Parameters
$uid : string

user id

Tags
throws
Exception

if user id was not found in LDAP

since
11.0.0
Return values
string —

the base for groups

getLDAPBaseUsers()

Get the LDAP base for users.

public getLDAPBaseUsers(string $uid) : string
Parameters
$uid : string

user id

Tags
throws
Exception

if user id was not found in LDAP

since
11.0.0
Return values
string —

the base for users

getLDAPConnection()

Return a new LDAP connection resource for the specified user.

public getLDAPConnection(string $uid) : Connection
Parameters
$uid : string

user id

Tags
since
11.0.0
Return values
Connection

getLDAPDisplayNameField()

Get the LDAP attribute name for the user's display name

public getLDAPDisplayNameField(string $uid) : string
Parameters
$uid : string

user id

Tags
throws
Exception

if user id was not found in LDAP

since
12.0.0
Return values
string —

the display name field

getLDAPEmailField()

Get the LDAP attribute name for the email

public getLDAPEmailField(string $uid) : string
Parameters
$uid : string

user id

Tags
throws
Exception

if user id was not found in LDAP

since
12.0.0
Return values
string —

the email field

getLDAPGroupMemberAssoc()

Get the LDAP attribute name for the type of association between users and groups

public getLDAPGroupMemberAssoc(string $gid) : string
Parameters
$gid : string

group id

Tags
throws
Exception

if group id was not found in LDAP

since
13.0.0
Return values
string —

the configuration, one of: 'memberUid', 'uniqueMember', 'member', 'gidNumber', ''

getMultiValueUserAttribute()

Get a multi-value LDAP attribute for a nextcloud user

public getMultiValueUserAttribute(string $uid, string $attribute) : array<string|int, mixed>
Parameters
$uid : string
$attribute : string
Tags
throws
Exception

if user id was not found in LDAP

since
22.0.0
Return values
array<string|int, mixed>

getUserAttribute()

Get an LDAP attribute for a nextcloud user

public getUserAttribute(string $uid, string $attribute) : string|null
Parameters
$uid : string
$attribute : string
Tags
throws
Exception

if user id was not found in LDAP

since
21.0.0
Return values
string|null

getUserDN()

Translate a user id to LDAP DN.

public getUserDN(string $uid) : string
Parameters
$uid : string

user id

Tags
since
11.0.0
Return values
string

getUserName()

Translate a LDAP DN to an internal user name.

public getUserName(string $dn) : string
Parameters
$dn : string

LDAP DN

Tags
throws
Exception

if translation was unsuccessful

since
11.0.0
Return values
string —

with the internal user name

sanitizeDN()

Sanitize a DN received from the LDAP server.

public sanitizeDN(array<string|int, mixed>|string $dn) : array<string|int, mixed>|string
Parameters
$dn : array<string|int, mixed>|string

the DN in question

Tags
since
11.0.0
Return values
array<string|int, mixed>|string —

the sanitized DN

On this page

Search results