User.reject - Python API

Changes a user’s approval_status to ‘rejected’. A rejected user may not log in until he or she is approved. It is not an error to reject an already rejected user.

Only super-users may approve or reject other users.

API

self.sso.user.reject_user

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

Rejects a user, changing his or her approval_status to ‘rejected’.

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 RejectUser(Service):
    def handle(self):

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

        # User to approve
        user_id = 'zusrzw764rvcr84vtcb3ctyha5cbe'

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