mirror of
https://github.com/samba-team/samba.git
synced 2025-03-20 22:50:26 +03:00
s4-dsdb: Added a helper to python SamDB for retrieving and setting minPwdAge.
This commit is contained in:
parent
b85dfce745
commit
c88b90e9f6
@ -602,3 +602,18 @@ accountExpires: %u
|
||||
|
||||
def get_partitions_dn(self):
|
||||
return dsdb._dsdb_get_partitions_dn(self)
|
||||
|
||||
def set_minPwdAge(self, value):
|
||||
m = ldb.Message()
|
||||
m.dn = ldb.Dn(self, self.domain_dn())
|
||||
m["minPwdAge"] = ldb.MessageElement(value, ldb.FLAG_MOD_REPLACE, "minPwdAge")
|
||||
self.modify(m)
|
||||
|
||||
def get_minPwdAge(self):
|
||||
res = self.search(self.domain_dn(), scope=ldb.SCOPE_BASE, attrs=["minPwdAge"])
|
||||
if len(res) == 0:
|
||||
return None
|
||||
elif not "minPwdAge" in res[0]:
|
||||
return None
|
||||
else:
|
||||
return res[0]["minPwdAge"][0]
|
||||
|
Loading…
x
Reference in New Issue
Block a user