Skip to content

Commit 3e94295

Browse files
committed
Merge pull request github#25 from github/gjtorikian-patch-1
Create 2fa_checker.rb
2 parents a4569c1 + 0023724 commit 3e94295

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

api/ruby/2fa_checker.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'octokit.rb'
2+
3+
if ARGV.length != 1
4+
$stderr.puts "Pass in the name of the organization you're interested in checking."
5+
exit 1
6+
end
7+
8+
# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
9+
# Instead, set and test environment variables, like below
10+
client = Octokit::Client.new(:access_token => ENV['MY_PERSONAL_TOKEN'])
11+
12+
ORG = ARGV[0].to_s
13+
14+
client.organization_members(ORG, { :filter => "2fa_disabled" }).each do |user|
15+
puts "#{user[:login]} does not have 2FA enabled, and yet is a member of #{ORG}!"
16+
end

0 commit comments

Comments
 (0)