User.delete - Python API

Deletes a user by ID - may be a regular one or super-super. Current user must be a super-user and cannot delete his or her own account.

API

self.sso.user.delete_user_by_id

delete_user_by_id(self, cid, user_id, current_ust, current_app, remote_addr):

Deletes a user by ID.

Parameters:
  • cid (string) – Correlation ID used by audit log
  • user_id (string) – ID of the user to delete
  • current_ust (string) – Current user’s UST
  • current_app (string) – Name of application the current user is issuing the call from
  • remote_addr (string) – User’s remote address
Return type:

None - there is no response on success but an exception may be raised at any point on failure

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, print_function, unicode_literals

# stdlib
from random import randint

# Zato
from zato.server.service import Service

class DeleteUser(Service):
    def handle(self):

        # Request metadata
        current_ust = 'gAAAAABalo6MX7z62Pyo416OFfDJ-4MuTMmSpIqAmvOXWc..'
        current_app = 'CRM'
        remote_addr = '127.0.0.1'

        # User to delete
        user_id = 'zusr4datdm5k5m8fbb8fttx5d65avm'

        # Delete the user
        self.sso.user.delete_user_by_id(self.cid, user_id, current_ust, current_app, remote_addr)