From e25654741196706239962a7d7532116fc5d6ea94 Mon Sep 17 00:00:00 2001 From: Touch Ungboriboonpisal Date: Fri, 14 Sep 2018 20:17:58 -0700 Subject: [PATCH] Normalize (make lowercase) the ldap group dn when onboarding Fixes #5895 Signed-off-by: Touch Ungboriboonpisal --- .gitignore | 1 + src/common/dao/group/usergroup.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index d85ad3d6f..a5b6b3113 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ src/portal/typings/ **/*npm-debug.log.* **/*yarn-error.log.* .idea/ +*.iml .DS_Store .project .vscode/ diff --git a/src/common/dao/group/usergroup.go b/src/common/dao/group/usergroup.go index 5e9504b08..c855030e9 100644 --- a/src/common/dao/group/usergroup.go +++ b/src/common/dao/group/usergroup.go @@ -116,6 +116,8 @@ func UpdateUserGroupName(id int, groupName string) error { // This is used for ldap and uaa authentication, such the usergroup can have an ID in Harbor. // the keyAttribute and combinedKeyAttribute are key columns used to check duplicate usergroup in harbor func OnBoardUserGroup(g *models.UserGroup, keyAttribute string, combinedKeyAttributes ...string) error { + g.LdapGroupDN = utils.TrimLower(g.LdapGroupDN) + o := dao.GetOrmer() created, ID, err := o.ReadOrCreate(g, keyAttribute, combinedKeyAttributes...) if err != nil {