SuperUser.create - Python API

Creates a new super-user. Current user's UST must belong to an already existing super-user.


create_super_user(self, cid, data, current_ust, current_app, remote_addr)

  • cid: Correlation ID used by audit log
  • data: A dictionary of values to create a new user from. On output, the dictionary will be enriched with defaults assigned during the creation process.
  • current_ust: Current user's UST
  • current_app: Name of application the current user is issuing the call from
  • remote_addr: User's remote address
  • Returns: None - the input 'data' dictionary is modified in place.

The 'data' dictionary is in the format described below:

Key Optional Default Notes
username --- --- Must be unique among all users
password Yes 192 bits If not given, a random string of 192 bits will be assigned
password_must_change Yes False
display_name Yes --- Display name
first_name Yes --- First name
middle_name Yes --- Middle name
last_name Yes --- Last name
email Yes --- User's email
is_locked Yes --- Should the account be locked upon creation, i.e. logging in will not be possible
sign_up_status Yes final User's initial signup status, by default it is 'final' meaning the user is fully signed up
# -*- coding: utf-8 -*-

# Zato
from zato.server.service import Service

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

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

        # Creation data
        data = {
          'username': 'admin1',
          'password': 'Zp=VZMdZ2-!S6EJ5~sh5cfMiZ7--,aD3Nbya ^8j',
          'password_must_change': True,
          'display_name': 'My User'

        # Create user
        self.sso.user.create_super_user(self.cid, data, current_ust, current_app, remote_addr)

        # The input dictionary will have been updated in place
  'display_name': 'My User',
  'is_active': True,
  'is_internal': False,
  'is_super_user': True,
  'is_approved': True,
  'is_locked': False,
  'password_expiry': datetime.datetime(2020, 2, 28, 11, 33, 13, 359733),
  'password_must_change': True,
  'password_last_set': datetime.datetime(2023, 2, 28, 11, 33, 13, 359733),
  'sign_up_time': datetime.datetime(2023, 2, 28, 11, 33, 13, 359733),
  'sign_up_status': 'final',
  'username': 'admin1',
  'user_id': 'zusr5znzppxrwp8dp8qsp5g8khes86'