29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/chef/knife/user_invite_recind.rb', line 29
def run
if name_args.length < 1 and ! config.has_key?(:all)
show_usage
ui.fatal("You must specify a username.")
exit 1
end
@invites = Hash.new
usernames = name_args
rest.get_rest("association_requests").each { |i| @invites[i['username']] = i['id'] }
if config[:all]
ui.confirm("Are you sure you want to recind all association requests")
@invites.each do |u,i|
rest.delete_rest("association_requests/#{i}")
end
else
ui.confirm("Are you sure you want to recind the association requests for: #{usernames.join(', ')}")
usernames.each do |u|
if @invites.has_key?(u)
rest.delete_rest("association_requests/#{@invites[u]}")
else
ui.fatal("No association request for #{u}.")
exit 1
end
end
end
end
|