Add ability to lowercase the LDAP name for use as PG role name

This commit is contained in:
Lars Kanis 2012-11-14 11:03:50 +01:00
parent f5be151bd6
commit 1df48950f5
3 changed files with 12 additions and 0 deletions

View File

@ -21,6 +21,8 @@ ldap_users:
filter: (&(objectClass=person)(objectClass=organizationalPerson)(givenName=*)(sn=*)(sAMAccountName=*))
# this attribute is used as PG role name
name_attribute: sAMAccountName
# lowercase name for use as PG role name
lowercase_name: true
# Search parameters for LDAP groups which should be synchronized
ldap_groups:
@ -28,6 +30,8 @@ ldap_groups:
filter: (cn=company.*)
# this attribute is used as PG role name
name_attribute: cn
# lowercase name for use as PG role name
lowercase_name: false
# this attribute must reference to all member DN's of the given group
member_attribute: member

View File

@ -17,6 +17,9 @@ mapping:
"name_attribute":
type: str
required: yes
"lowercase_name":
type: bool
required: no
"ldap_groups":
type: map
@ -31,6 +34,9 @@ mapping:
"name_attribute":
type: str
required: yes
"lowercase_name":
type: bool
required: no
"member_attribute":
type: str
required: yes

View File

@ -85,6 +85,7 @@ class Application
log.warn "user attribute #{ldap_user_conf[:name_attribute].inspect} not defined for #{entry.dn}"
next
end
name.downcase! if ldap_user_conf[:lowercase_name]
log.info "found user-dn: #{entry.dn}"
user = LdapRole.new name, entry.dn
@ -111,6 +112,7 @@ class Application
log.warn "user attribute #{ldap_group_conf[:name_attribute].inspect} not defined for #{entry.dn}"
next
end
name.downcase! if ldap_group_conf[:lowercase_name]
log.info "found group-dn: #{entry.dn}"
group = LdapRole.new name, entry.dn, entry[ldap_group_conf[:member_attribute]]