diff --git a/config-raw.json b/config-raw.json index bfe2fd37e..ff383b5be 100644 --- a/config-raw.json +++ b/config-raw.json @@ -799,6 +799,11 @@ "key": "displayname", "default_value": "displayName", "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." } ] } diff --git a/pkg/config/config.go b/pkg/config/config.go index 460b1282e..e0cd77e03 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -94,6 +94,7 @@ const ( AuthLdapAttributeUsername Key = `auth.ldap.attribute.username` AuthLdapAttributeEmail Key = `auth.ldap.attribute.email` AuthLdapAttributeDisplayname Key = `auth.ldap.attribute.displayname` + AuthLdapAttributeMemberID Key = `auth.ldap.attribute.memberid` LegalImprintURL Key = `legal.imprinturl` LegalPrivacyURL Key = `legal.privacyurl` @@ -360,6 +361,7 @@ func InitDefaultConfig() { AuthLdapAttributeUsername.setDefault("uid") AuthLdapAttributeEmail.setDefault("mail") AuthLdapAttributeDisplayname.setDefault("displayName") + AuthLdapAttributeMemberID.setDefault("member") // Database DatabaseType.setDefault("sqlite") diff --git a/pkg/modules/auth/ldap/ldap.go b/pkg/modules/auth/ldap/ldap.go index df7ec454b..0299e555e 100644 --- a/pkg/modules/auth/ldap/ldap.go +++ b/pkg/modules/auth/ldap/ldap.go @@ -231,7 +231,7 @@ func syncUserGroups(l *ldap.Conn, u *user.User, userdn string) (err error) { []string{ "dn", "cn", - "member", + config.AuthLdapAttributeMemberID.GetString(), "description", }, nil, @@ -247,7 +247,7 @@ func syncUserGroups(l *ldap.Conn, u *user.User, userdn string) (err error) { for _, group := range sr.Entries { groupName := group.GetAttributeValue("cn") - members := group.GetAttributeValues("member") + members := group.GetAttributeValues(config.AuthLdapAttributeMemberID.GetString()) description := group.GetAttributeValue("description") log.Debugf("Group %s has %d members", groupName, len(members))