suseapi.userinfo
¶
This module allows remote access to LDAP. It wraps standard Python module for LDAP and provides some convenience functions.
-
class
suseapi.userinfo.
UserInfo
(server, base)¶ Parameters: - server (string) – Server address
- base (string) – Search base
LDAP class wrapping ldap access.
-
search_uid
(uid, attribs=None)¶ Parameters: - uid (string) – Search string
- attribs (list of strings) – Attributes to read from LDAP, defaults to [‘cn’, ‘mail’, ‘ou’, ‘sn’, ‘givenName’]
Return type: list of dictionaries
Returns: Search results
Performs UID search and returns list of search results.
-
search_by
(attr, val, attribs=None)¶ Parameters: - attr – attribute name to search by
- val – value of the attribute to search for
- attribs – attributes to return
Performs search by any attribute.
-
get_department
(user)¶ Parameters: user (string) – Search string Return type: string Returns: Department name, N/A
in case it was not found.Performs LDAP search and grabs department name from it. Additionally some fixups are applied to department names to avoid more names for single department.
-
class
suseapi.userinfo.
DjangoUserInfo
(server, base)¶ Wrapper around
suseapi.userinfo.UserInfo
class to use Django settings and cache results in Django cache.