ldap_auth.patch
ldap_auth.rb 2014-11-14 07:08:19.691930482 +0000 | ||
---|---|---|
47 | 47 |
:mapping_timeout => 300, |
48 | 48 |
:mapping_filename => 'server1.yaml', |
49 | 49 |
:mapping_key => 'GROUP_DN', |
50 |
:mapping_default => 1 |
|
50 |
:mapping_default => 1, |
|
51 |
:attributes => [ "memberOf" ] |
|
51 | 52 |
}.merge(options) |
52 | 53 |
ops={} |
... | ... | |
123 | 124 |
begin |
124 | 125 |
result=@ldap.search( |
125 | 126 |
:base => @options[:base], |
127 |
:attributes => @options[:attributes], |
|
126 | 128 |
:filter => "#{@options[:user_field]}=#{name}") |
127 | 129 |
if result && result.first |
... | ... | |
146 | 148 |
def is_in_group?(user, group) |
147 | 149 |
result=@ldap.search( |
148 | 150 |
:base => group, |
151 |
:attributes => @options[:group_field], |
|
149 | 152 |
:filter => "(#{@options[:group_field]}=#{user.first})") |
150 | 153 |
if result && result.first |
... | ... | |
183 | 186 |
end |
184 | 187 |
groups.delete(false) |
185 |
groups.compact |
|
188 |
groups.compact.uniq
|
|
186 | 189 |
end |
187 | 190 |
end |