diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-14 11:00:08 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-14 11:00:08 +0000 |
commit | 4d64a32c88dd5f87621d391c0f10f6acef094073 (patch) | |
tree | 1a6f479e09c97d2e0526da4405c98f57f9825456 /app/services | |
parent | cda9635441fee1543966830a0ba1d95221b2a379 (diff) | |
parent | dd6fc01ff8a073880b67a323a547edeb5d63f167 (diff) | |
download | gitlab-ce-4d64a32c88dd5f87621d391c0f10f6acef094073.tar.gz |
Merge branch 'feature/ldap-sync-edgecases' into 'master'
LDAP Sync blocked user edgecases
Allow GitLab admins to block otherwise valid GitLab LDAP users
(https://gitlab.com/gitlab-org/gitlab-ce/issues/3462)
Based on the discussion on the original issue, we are going to differentiate "normal" block operations to the ldap automatic ones in order to make some decisions when its one or the other.
Expected behavior:
- [x] "ldap_blocked" users respond to both `blocked?` and `ldap_blocked?`
- [x] "ldap_blocked" users can't be unblocked by the Admin UI
- [x] "ldap_blocked" users can't be unblocked by the API
- [x] Block operations that are originated from LDAP synchronization will flag user as "ldap_blocked"
- [x] Only "ldap_blocked" users will be automatically unblocked by LDAP synchronization
- [x] When LDAP identity is removed, we should convert `ldap_blocked` into `blocked`
Mockup for the Admin UI with both "ldap_blocked" and normal "blocked" users:
![image](/uploads/4f56fc17b73cb2c9e2a154a22e7ad291/image.png)
There will be another MR for the EE version.
See merge request !2242
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/repair_ldap_blocked_user_service.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/services/repair_ldap_blocked_user_service.rb b/app/services/repair_ldap_blocked_user_service.rb new file mode 100644 index 00000000000..863cef7ff61 --- /dev/null +++ b/app/services/repair_ldap_blocked_user_service.rb @@ -0,0 +1,17 @@ +class RepairLdapBlockedUserService + attr_accessor :user + + def initialize(user) + @user = user + end + + def execute + user.block if ldap_hard_blocked? + end + + private + + def ldap_hard_blocked? + user.ldap_blocked? && !user.ldap_user? + end +end |