User.unlock - Python API

Unlocks a user account. Current user must be a super-user.

Use User.lock to lock users.


unlock_user(self, cid, user_id, current_ust, current_app, remote_addr)

  • cid: Correlation ID used by audit log
  • user_id: ID of the user to unlock
  • 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 - there is no response on success but an exception may be raised at any point on failure
# -*- 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 UnlockUser(Service):
    def handle(self):

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

        # User to lock
        user_id = 'zusr6htgg7hhdj8zrvvatbyfawxfsw'

        # Lock the user
        self.sso.user.lock_user(self.cid, user_id, current_ust, current_app, remote_addr)