diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-04 17:10:06 +0300 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-04 17:10:06 +0300 |
| commit | c8ac0ab392e33e66a6b984774091b8aae9661790 (patch) | |
| tree | 629a8d1dc5be91d34b9802147d1219c5ba687171 | |
| parent | d8f4c363d65ab6c2f06f70edc742bee2c1431cdf (diff) | |
| parent | ec61dfdc8cea4c6a3e8a03790eb1c225f8562d27 (diff) | |
| download | gitlab-ce-c8ac0ab392e33e66a6b984774091b8aae9661790.tar.gz | |
Merge pull request #7208 from MrMarvin/ce_rake_cleanup_ldap_users
Adds rake task to clean up deleted LDAP users
| -rw-r--r-- | lib/tasks/gitlab/cleanup.rake | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake index 4aaab11340f..63dcdc52370 100644 --- a/lib/tasks/gitlab/cleanup.rake +++ b/lib/tasks/gitlab/cleanup.rake @@ -84,5 +84,29 @@ namespace :gitlab do puts "To cleanup this directories run this command with REMOVE=true".yellow end end + + desc "GITLAB | Cleanup | Block users that have been removed in LDAP" + task block_removed_ldap_users: :environment do + warn_user_is_not_gitlab + block_flag = ENV['BLOCK'] + + User.ldap.each do |ldap_user| + print "#{ldap_user.name} (#{ldap_user.extern_uid}) ..." + if Gitlab::LDAP::Access.open { |access| access.allowed?(ldap_user) } + puts " [OK]".green + else + if block_flag + ldap_user.block! + puts " [BLOCKED]".red + else + puts " [NOT IN LDAP]".yellow + end + end + end + + unless block_flag + puts "To block these users run this command with BLOCK=true".yellow + end + end end end |
