mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Completely remove attributes when delattr argument
This commit is contained in:
@@ -91,7 +91,15 @@ def main():
|
|||||||
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
try:
|
try:
|
||||||
user = client.get_user_by_uid(username)
|
attrs = ['*']
|
||||||
|
|
||||||
|
# in case any attributes being modified are operational such as
|
||||||
|
# nsaccountlock. Any attribute to be deleted needs to be included
|
||||||
|
# in the original record so it can be seen as being removed.
|
||||||
|
if options.delattr:
|
||||||
|
for d in options.delattr:
|
||||||
|
attrs.append(d)
|
||||||
|
user = client.get_user_by_uid(username, sattrs=attrs)
|
||||||
except ipa.ipaerror.exception_for(ipa.ipaerror.LDAP_NOT_FOUND):
|
except ipa.ipaerror.exception_for(ipa.ipaerror.LDAP_NOT_FOUND):
|
||||||
print "User %s not found" % username
|
print "User %s not found" % username
|
||||||
return 1
|
return 1
|
||||||
@@ -203,8 +211,7 @@ def main():
|
|||||||
|
|
||||||
if options.delattr:
|
if options.delattr:
|
||||||
for d in options.delattr:
|
for d in options.delattr:
|
||||||
# doesn't truly delete the attribute but does null out the value
|
user.delValue(d)
|
||||||
user.setValue(d, '')
|
|
||||||
|
|
||||||
if options.setattr:
|
if options.setattr:
|
||||||
for s in options.setattr:
|
for s in options.setattr:
|
||||||
|
|||||||
Reference in New Issue
Block a user