Skip to content

Commit

Permalink
feat: DingTalk provider value case unsensitive (casdoor#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
Resulte authored Apr 30, 2022
1 parent 8e48bdd commit 912d9d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions object/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,14 @@ func TestGetMaskedUsers(t *testing.T) {
})
}
}

func TestGetUserByField(t *testing.T) {
InitConfig()

user := GetUserByField("built-in", "DingTalk", "test")
if user != nil {
t.Logf("%+v", user)
} else {
t.Log("no user found")
}
}
2 changes: 1 addition & 1 deletion object/user_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func GetUserByField(organizationName string, field string, value string) *User {
}

user := User{Owner: organizationName}
existed, err := adapter.Engine.Where(fmt.Sprintf("%s=?", field), value).Get(&user)
existed, err := adapter.Engine.Where(fmt.Sprintf("%s=?", strings.ToLower(field)), value).Get(&user)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 912d9d0

Please sign in to comment.