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.

API

self.sso.user.approve_user

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

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

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

(None)

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

from __future__ import absolute_import, division, print_function, unicode_literals

# Zato
from zato.server.service import Service

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

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

        # User to approve
        user_id = 'zusr17k3x6wgp4839t30d9knrpvsah'

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