Commit 063e9f9a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ldap_admin_group' into 'master'

Be sure that admin_group exists before trying to check for user membership.

Related to #257

See merge request !334
parents c59d1fbb 0b145281
v 7.9.0 (unreleased)
- Strip prefixes and suffixes from synced SSH keys:
- Strip prefixes and suffixes from synced SSH keys:
`SSHKey:ssh-rsa keykeykey` and `ssh-rsa keykeykey (SSH key)` will now work
- Check if LDAP admin group exists before querying for user membership
v 7.8.0
- Improved Jira issue closing integration
......
......@@ -110,7 +110,9 @@ module Gitlab
def update_admin_status
admin_group = Gitlab::LDAP::Group.find_by_cn(ldap_config.admin_group, adapter)
if admin_group.has_member?(Gitlab::LDAP::Person.find_by_dn(user.ldap_identity.extern_uid, adapter))
admin_user = Gitlab::LDAP::Person.find_by_dn(user.ldap_identity.extern_uid, adapter)
if admin_group && admin_group.has_member?(admin_user)
unless user.admin?
user.admin = true
user.save
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment