class Tapjoy::LDAP::CLI::Group::RemoveUser

Remove existing user to existing group

Public Instance Methods

remove_user() click to toggle source
# File lib/tapjoy/ldap/cli/group/remove_user.rb, line 7
def remove_user
  confirm unless opts[:force]
  puts Tapjoy::LDAP::API::Group.update(
    opts[:group], opts[:username], :delete)
end

Private Instance Methods

confirm() click to toggle source
# File lib/tapjoy/ldap/cli/group/remove_user.rb, line 26
def confirm
  puts "Confirm that you want to remove user #{opts[:username]} from group #{opts[:group]} (yes/no)"
  print '>'
  confirm = STDIN.gets.chomp.downcase
  abort("Deletion of #{opts[:name]} aborted") unless confirm.start_with?('y')
end
opts() click to toggle source
# File lib/tapjoy/ldap/cli/group/remove_user.rb, line 15
def opts
  @opts ||= Optimist.options do
    # Set help message
    usage 'group remove_user [options]'
    synopsis "\nThis command is for removing existing users from existing groups"

    opt(:group, 'Specify group', type: :string, required: true)
    opt(:username, 'Specify username', type: :string, required: true)
  end
end