summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/user.py
diff options
context:
space:
mode:
authorNathaniel McCallum <npmccallum@redhat.com>2013-10-01 14:26:38 -0400
committerPetr Viktorin <pviktori@redhat.com>2013-12-18 09:58:59 +0100
commit397b2876e2f9bf1c5b3ad3e2874a92715ccda599 (patch)
tree05156e975b1799e1623456d2423bcc8d82082ab3 /ipalib/plugins/user.py
parent1a9beac1bebc7d9b0207053a7eb6d775cae590d1 (diff)
downloadfreeipa-397b2876e2f9bf1c5b3ad3e2874a92715ccda599.tar.gz
freeipa-397b2876e2f9bf1c5b3ad3e2874a92715ccda599.tar.xz
freeipa-397b2876e2f9bf1c5b3ad3e2874a92715ccda599.zip
Add OTP support to ipalib CLI
https://fedorahosted.org/freeipa/ticket/3368
Diffstat (limited to 'ipalib/plugins/user.py')
-rw-r--r--ipalib/plugins/user.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index ae927b642..3c8353ffa 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -379,7 +379,7 @@ class user(LDAPObject):
cli_name='user_auth_type',
label=_('User authentication types'),
doc=_('Types of supported user authentication'),
- values=(u'password', u'radius'),
+ values=(u'password', u'radius', u'otp'),
csv=True,
),
Str('userclass*',
@@ -648,6 +648,14 @@ class user_del(LDAPDelete):
def pre_callback(self, ldap, dn, *keys, **options):
assert isinstance(dn, DN)
check_protected_member(keys[-1])
+
+ # Delete all tokens owned by this user
+ owner = self.api.Object.user.get_primary_key_from_dn(dn)
+ results = self.api.Command.otptoken_find(ipatokenowner=owner)['result']
+ for token in results:
+ token = self.api.Object.otptoken.get_primary_key_from_dn(token['dn'])
+ self.api.Command.otptoken_del(token)
+
return dn
api.register(user_del)