Skip to content

Commit

Permalink
LDAP: inetOrgPerson scheme added
Browse files Browse the repository at this point in the history
  • Loading branch information
patriki01 authored and pbrezina committed Nov 3, 2023
1 parent d11979a commit 3a1c4af
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions sssd_test_framework/roles/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ def add(
shadowMax: int | None = None,
shadowWarning: int | None = None,
shadowLastChange: int | None = None,
sn: str | None = None,
mail: str | None = None,
) -> LDAPUser:
"""
Create new LDAP user.
Expand Down Expand Up @@ -664,6 +666,10 @@ def add(
:type shadowWarning: int | None, optional
:param shadowLastChange: shadowlastchage LDAP attribute, defaults to None
:type shadowLastChange: int | None, optional
:param sn: surname LDAP attribute, defaults to None
:type sn: str | None, optional
:param mail: mail LDAP attribute, defaults to None
:type mail: str | None, optional
:return: Self.
:rtype: LDAPUser
"""
Expand All @@ -689,11 +695,17 @@ def add(
"shadowMax": shadowMax,
"shadowWarning": shadowWarning,
"shadowLastChange": shadowLastChange,
"sn": sn,
"mail": mail,
}

if to_list_without_none([shadowMin, shadowMax, shadowWarning, shadowLastChange]):
attrs["objectClass"].append("shadowAccount")

if to_list_without_none([sn, mail]):
attrs["sn"] = sn if sn else str(uid)
attrs["objectClass"].append("inetOrgPerson")

self._add(attrs)
return self

Expand All @@ -710,6 +722,8 @@ def modify(
shadowMax: int | DeleteAttribute | None = None,
shadowWarning: int | DeleteAttribute | None = None,
shadowLastChange: int | DeleteAttribute | None = None,
sn: str | DeleteAttribute | None = None,
mail: str | DeleteAttribute | None = None,
) -> LDAPUser:
"""
Modify existing LDAP user.
Expand All @@ -735,6 +749,10 @@ def modify(
:type shadowWarning: int | DeleteAttribute | None, optional
:param shadowLastChange: shadowlastchage LDAP attribute, defaults to None
:type shadowLastChange: int | DeleteAttribute | None, optional
:param sn: surname LDAP attribute, defaults to None
:type sn: str | DeleteAttribute | None, optional
:param mail: mail LDAP attribute, defaults to None
:type mail: str | DeleteAttribute | None, optional
:return: Self.
:rtype: LDAPUser
"""
Expand All @@ -749,6 +767,8 @@ def modify(
"shadowMax": shadowMax,
"shadowWarning": shadowWarning,
"shadowLastChange": shadowLastChange,
"sn": sn,
"mail": mail,
}

self._set(attrs)
Expand Down

0 comments on commit 3a1c4af

Please sign in to comment.