This repository was archived by the owner on Jun 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 33# Checks if classroom admins have access to the associated GitHub organization. If not
44# the admin is removed from the classroom
55task :remove_classroom_users_without_github_org_access do
6- User . find_in_batches ( batch_size : 250 ) do |group , batch |
7- puts "Processing group ##{ batch } "
6+ User . find_in_batches ( batch_size : 250 ) . with_index do |group , batch |
7+ puts "Processing batch ##{ batch } "
88 group . each do |user |
99 github_org_ids = user . organizations . pluck ( :github_id ) . uniq
1010 next unless github_org_ids . any?
1111
1212 github_org_ids . each do |gh_id |
1313 github_org = GitHubOrganization . new ( user . github_client , gh_id )
14- next unless github_org . admin? ( user . github_user . login )
14+ next if github_org . admin? ( user . github_login )
1515
1616 payload = {
1717 "action" : "member_removed" ,
1818 "membership" : { "user" : { "id" : user . github_user . id } } ,
1919 "organization" : { "id" : gh_id }
2020 }
2121
22+ puts "Removing #{ user . github_login } from org with id ##{ gh_id } "
2223 OrganizationEventJob . perform_later ( payload )
2324 end
2425 end
You can’t perform that action at this time.
0 commit comments