User.approve - Python API

Changes a user's approval_status to 'approved', thus making it possible for that user to log in, provided that other conditions are fulfilled, e.g. user connects from an allowed IP address. It is not an error to approve an already approved user.

Only super-users may approve or reject other users.


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

Approves a user, changing his or her approval_status to 'approved'.

  • cid: Correlation ID used by audit log
  • user_id: ID of the user to approve
  • current_ust: Current user's UST - must belong to a super-user
  • current_app: Name of application the current user is issuing the call from
  • remote_addr: User's remote address
  • Returns: (None)
# -*- coding: utf-8 -*-

# Zato
from zato.server.service import Service

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

        # Request metadata
        current_ust = 'gAAAAABanYUOu2NAMqTVXihxl3gLsdYcbkIJI72WZIIX...'
        current_app = 'CRM'
        remote_addr = ''

        # User to approve
        user_id = 'zusr17k3x6wgp4839t30d9knrpvsah'

        self.sso.user.approve_user(self.cid, data, current_ust, current_app, remote_addr)