class DTK::Client::Operation::Account::RegisterCatalogUser

Public Class Methods

execute(args = Args.new) click to toggle source
# File lib/client/operation/account/register_catalog_user.rb, line 21
def self.execute(args = Args.new)
  body_params = DTK::Client::InteractiveWizard.interactive_user_input([
 {:username => { :required => true} },
 {:password => { :type => :password }},
 {:repeat_password => { :type => :repeat_password }},
 {:email => { :type => :email, :required => true }},
 {:first_name => {}},
 {:last_name => {}}
])
OsUtil.print("Creating account please wait ...", :white)

response = rest_post("#{RoutePrefix}/register_catalog_account", body_params) 

if response.ok?
  OsUtil.print("You have successfully created catalog account!", :green)
  if DTK::Client::Console.prompt_yes_no("Do you want to make this account active?")
    post_body =  { :username => body_params[:username], :password => body_params[:password], :validate => true }
    response = rest_post("#{RoutePrefix}/set_catalog_credentials", post_body)
    OsUtil.print("Catalog user '#{body_params[:username]}' is currently active user!", :green)
  end
else
  return response
end

nil
end