code: def delete(self, user_id):
          
          auditlog(event='user.delete', actor=session['user'].username, data={'userId': user_id})
          if session['user'].user_id == user_id:
              return self.make_response(
                  'You cannot delete the user you are currently logged in as',
                  HTTP.FORBIDDEN
              )
  
          user = db.User.find_one(User.user_id == user_id)
          if not user:
              return self.make_response('No such user id found: {}'.format(user_id), HTTP.UNAUTHORIZED)
  
          if user.username == 'admin' and user.auth_system == 'builtin':
              return self.make_response('You cannot delete the built-in admin user', HTTP.FORBIDDEN)
  
          username = user.username
          auth_system = user.auth_system
          db.session.delete(user)
          db.session.commit()
  
          return self.make_response('User {}/{} has been deleted'.format(auth_system, username), HTTP.OK)
docs: Delete a user