feat(ldap): make member id attribute configurable
This commit is contained in:
parent
84cbd25e67
commit
f4b9a9cccd
|
|
@ -799,6 +799,11 @@
|
||||||
"key": "displayname",
|
"key": "displayname",
|
||||||
"default_value": "displayName",
|
"default_value": "displayName",
|
||||||
"comment": "The LDAP attribute used to set the displayed name in Vikunja."
|
"comment": "The LDAP attribute used to set the displayed name in Vikunja."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "memberid",
|
||||||
|
"default_value": "member",
|
||||||
|
"comment": "The LDAP attribute used to check group membership of a team in Vikunja. Only used when groups are synced to Vikunja."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ const (
|
||||||
AuthLdapAttributeUsername Key = `auth.ldap.attribute.username`
|
AuthLdapAttributeUsername Key = `auth.ldap.attribute.username`
|
||||||
AuthLdapAttributeEmail Key = `auth.ldap.attribute.email`
|
AuthLdapAttributeEmail Key = `auth.ldap.attribute.email`
|
||||||
AuthLdapAttributeDisplayname Key = `auth.ldap.attribute.displayname`
|
AuthLdapAttributeDisplayname Key = `auth.ldap.attribute.displayname`
|
||||||
|
AuthLdapAttributeMemberID Key = `auth.ldap.attribute.memberid`
|
||||||
|
|
||||||
LegalImprintURL Key = `legal.imprinturl`
|
LegalImprintURL Key = `legal.imprinturl`
|
||||||
LegalPrivacyURL Key = `legal.privacyurl`
|
LegalPrivacyURL Key = `legal.privacyurl`
|
||||||
|
|
@ -360,6 +361,7 @@ func InitDefaultConfig() {
|
||||||
AuthLdapAttributeUsername.setDefault("uid")
|
AuthLdapAttributeUsername.setDefault("uid")
|
||||||
AuthLdapAttributeEmail.setDefault("mail")
|
AuthLdapAttributeEmail.setDefault("mail")
|
||||||
AuthLdapAttributeDisplayname.setDefault("displayName")
|
AuthLdapAttributeDisplayname.setDefault("displayName")
|
||||||
|
AuthLdapAttributeMemberID.setDefault("member")
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
DatabaseType.setDefault("sqlite")
|
DatabaseType.setDefault("sqlite")
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ func syncUserGroups(l *ldap.Conn, u *user.User, userdn string) (err error) {
|
||||||
[]string{
|
[]string{
|
||||||
"dn",
|
"dn",
|
||||||
"cn",
|
"cn",
|
||||||
"member",
|
config.AuthLdapAttributeMemberID.GetString(),
|
||||||
"description",
|
"description",
|
||||||
},
|
},
|
||||||
nil,
|
nil,
|
||||||
|
|
@ -247,7 +247,7 @@ func syncUserGroups(l *ldap.Conn, u *user.User, userdn string) (err error) {
|
||||||
|
|
||||||
for _, group := range sr.Entries {
|
for _, group := range sr.Entries {
|
||||||
groupName := group.GetAttributeValue("cn")
|
groupName := group.GetAttributeValue("cn")
|
||||||
members := group.GetAttributeValues("member")
|
members := group.GetAttributeValues(config.AuthLdapAttributeMemberID.GetString())
|
||||||
description := group.GetAttributeValue("description")
|
description := group.GetAttributeValue("description")
|
||||||
|
|
||||||
log.Debugf("Group %s has %d members", groupName, len(members))
|
log.Debugf("Group %s has %d members", groupName, len(members))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue