def get_users_assigned_to_privilege(self, privilege_id, max_results=None):
        """

        Gets a list of the users assigned to a privilege.

        :param privilege_id: The id of the privilege.
        :type privilege_id: string

        :param max_results: Limit the number of users returned (optional)
        :type max_results: int

        Returns the list of users
        :return: user_ids list
        :rtype: list[int]

        See https://developers.onelogin.com/api-docs/1/privileges/get-users Get Assigned Users documentation

        """
        self.clean_error()

        if max_results is None:
            max_results = self.max_results if self.max_results > 1000 else 1000

        try:
            url = self.get_url(Constants.GET_USERS_ASSIGNED_TO_PRIVILEGE_URL, privilege_id)

            user_ids = []
            response = None
            after_cursor = None
            query_parameters = None
            while (not response) or (len(user_ids) < max_results and after_cursor):
                response = self.execute_call('get', url, params=query_parameters)
                if response.status_code == 200:
                    json_data = response.json()
                    if json_data and 'users' in json_data:
                        if len(user_ids) + len(json_data['users']) < max_results:
                            user_ids += json_data['users']
                        elif len(user_ids) + len(json_data['users']) == max_results:
                            user_ids += json_data['users']
                            return user_ids
                        else:
                            for user_id in json_data['users']:
                                if len(user_ids) < max_results:
                                    user_ids.append(user_id)
                                else:
                                    return user_ids

                    after_cursor = self.get_after_cursor(response)
                    if after_cursor:
                        if not query_parameters:
                            query_parameters = {}
                        query_parameters['after_cursor'] = after_cursor
                else:
                    self.error = str(response.status_code)
                    self.error_description = self.extract_error_message_from_response(response)
                    break

            return user_ids
        except Exception as e:
            self.error = 500
            self.error_description = e.args[0]
def get_users_assigned_to_privilege ( self , privilege_id , max_results = None ) : self . clean_error ( ) if max_results is None : max_results = self . max_results if self . max_results > 1000 else 1000 try : url = self . get_url ( Constants . GET_USERS_ASSIGNED_TO_PRIVILEGE_URL , privilege_id ) user_ids = [ ] response = None after_cursor = None query_parameters = None while ( not response ) or ( len ( user_ids ) < max_results and after_cursor ) : response = self . execute_call ( 'get' , url , params = query_parameters ) if response . status_code == 200 : json_data = response . json ( ) if json_data and 'users' in json_data : if len ( user_ids ) + len ( json_data [ 'users' ] ) < max_results : user_ids += json_data [ 'users' ] elif len ( user_ids ) + len ( json_data [ 'users' ] ) == max_results : user_ids += json_data [ 'users' ] return user_ids else : for user_id in json_data [ 'users' ] : if len ( user_ids ) < max_results : user_ids . append ( user_id ) else : return user_ids after_cursor = self . get_after_cursor ( response ) if after_cursor : if not query_parameters : query_parameters = { } query_parameters [ 'after_cursor' ] = after_cursor else : self . error = str ( response . status_code ) self . error_description = self . extract_error_message_from_response ( response ) break return user_ids except Exception as e : self . error = 500 self . error_description = e . args [ 0 ]
Gets a list of the users assigned to a privilege.

        :param privilege_id: The id of the privilege.
        :type privilege_id: string

        :param max_results: Limit the number of users returned (optional)
        :type max_results: int

        Returns the list of users
        :return: user_ids list
        :rtype: list[int]

        See https://developers.onelogin.com/api-docs/1/privileges/get-users Get Assigned Users documentation