August 9, 2017


Show user accounts with and without two-factor enabled

Get a list of users with two-factor authentication enabled/disabled.

To get a list of users with Two-Factor authentication enabled.


=begin
@author Ryan Tiffany
=end

require 'softlayer_api' 
require 'pp' 

# Connect to SoftLayer
client = SoftLayer::Client.new(:timeout => 120)

mask = 'mask[id,username,firstName,lastName,externalBindingCount,externalBindings]'

theFilter = {
'users' => {
	'externalBindings' => {
		'active' => {
			'operation' => '1'
		}}}
}

getUsers = client['SoftLayer_Account'].getUsers(filter=theFilter, mask=mask)
pp getUsers

To get a list of users without Two-Factor authentication enabled.

=begin
@author Ryan Tiffany
=end

require 'softlayer_api' 
require 'pp' 

# Connect to SoftLayer
client = SoftLayer::Client.new(:timeout => 120)

mask = 'mask[id,username,firstName,lastName,externalBindingCount,externalBindings]'

theFilter = {
'users' => {
	'externalBindings' => {
		'active' => {
			'operation' => '0'
		}}}
}

getUsers = client['SoftLayer_Account'].getUsers(filter=theFilter, mask=mask)
pp getUsers