Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP: inetOrgPerson scheme added #56

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading