def unbind_yubikey(self, request, username_or_id, prefix): user = self._get_user(request, username_or_id) try: del user.yubikeys[prefix] except KeyError: raise exc.HTTPNotFound return no_content()
def rename_user(self, request, username_or_id, username): user = self._get_user(request, username_or_id) try: request.auth.get_user(username) return json_error('User "%s" already exists!' % username) except: user.name = username return no_content()
def bind_yubikey(self, request, username_or_id, yubikey): user = self._get_user(request, username_or_id) user.assign_yubikey(yubikey) return no_content()
def _unset_attribute(self, owner, attribute_key): if attribute_key in owner.attributes: del owner.attributes[attribute_key] return no_content()
def _set_attribute(self, request, owner, key, value): owner.attributes[key] = value return no_content()
def delete_user(self, request, username_or_id): user = self._get_user(request, username_or_id) user.delete() return no_content()
def reset_password(self, request, username_or_id, password): user = self._get_user(request, username_or_id) user.set_password(password) return no_content()
def delete_yubikey(self, request, prefix): yubikey = self._get_yubikey(request, prefix) yubikey.delete() return no_content()
def unbind_yubikey(self, request, username_or_id, prefix): user = self._get_user(request, username_or_id) del user.yubikeys[prefix] return no_content()