Compare commits
No commits in common. "4f954c97d7278e796301d1459ab8d9087bf72366" and "757264c33af3550f04eb6c2dbcaed694b1621977" have entirely different histories.
4f954c97d7
...
757264c33a
35
lgit.py
35
lgit.py
@ -93,13 +93,6 @@ l dc values from base
|
|||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def isempty(self)->bool:
|
|
||||||
self.conn.search(search_base=self.base,search_filter='(objectClass=person)', attributes=['uid'])
|
|
||||||
response = self.conn.response
|
|
||||||
if response == []:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def gettotal(self, base: str = '')->int:
|
def gettotal(self, base: str = '')->int:
|
||||||
if base == '':
|
if base == '':
|
||||||
base = self.logbase
|
base = self.logbase
|
||||||
@ -310,34 +303,6 @@ l dc values from base
|
|||||||
|
|
||||||
return pushed
|
return pushed
|
||||||
|
|
||||||
def clone(self, source)->int:
|
|
||||||
# Delete all users from this server
|
|
||||||
self.conn.search(search_base=source.base,search_filter='(objectClass=person)', attributes=USERATTRIBUTES)
|
|
||||||
response = self.conn.response
|
|
||||||
if response != []:
|
|
||||||
for user in response:
|
|
||||||
uid = user.attributes['uid']
|
|
||||||
if isinstance(uid, list):
|
|
||||||
uid = uid[0]
|
|
||||||
self.conn.delete(f'uid={uid},{self.base}')
|
|
||||||
# Copy all users from source server
|
|
||||||
cloned = 0
|
|
||||||
source.conn.search(search_base=source.base,search_filter='(objectClass=person)', attributes=USERATTRIBUTES)
|
|
||||||
response = source.conn.response
|
|
||||||
if response == []:
|
|
||||||
return 0
|
|
||||||
else:
|
|
||||||
for user in response:
|
|
||||||
attributes = user.attributes
|
|
||||||
# If attribute returned as list, take only first element
|
|
||||||
for key in attributes:
|
|
||||||
if isinstance(attributes[key], list):
|
|
||||||
attributes[key] = attributes[key][0]
|
|
||||||
uid = attributes['uid']
|
|
||||||
self.conn.add(f'uid={uid},{self.base}', OBJECTCLASSES, attributes)
|
|
||||||
cloned += 1
|
|
||||||
return cloned
|
|
||||||
|
|
||||||
def lastpwchangenow(self):
|
def lastpwchangenow(self):
|
||||||
'''
|
'''
|
||||||
Return time of last password change for the user set to current time
|
Return time of last password change for the user set to current time
|
||||||
|
Loading…
Reference in New Issue
Block a user