Skip to content
Snippets Groups Projects
Unverified Commit ee5e2f8f authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Fix LDAP auth if attributes are arrays (#10913)

parent c44073e4
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
[permissions-group-membership :as perm-membership :refer [PermissionsGroupMembership]]] [permissions-group-membership :as perm-membership :refer [PermissionsGroupMembership]]]
[metabase.util [metabase.util
[date :as du] [date :as du]
[i18n :refer [deferred-tru trs]] [i18n :refer [trs]]
[schema :as su]] [schema :as su]]
[schema.core :as s] [schema.core :as s]
[toucan [toucan
...@@ -176,9 +176,8 @@ ...@@ -176,9 +176,8 @@
(email/send-new-user-email! new-user invitor join-url))) (email/send-new-user-email! new-user invitor join-url)))
(def LoginAttributes (def LoginAttributes
"Login attributes, currently not collected for LDAP or Google Auth. Will ultimately be stored as JSON" "Login attributes, currently not collected for LDAP or Google Auth. Will ultimately be stored as JSON."
(su/with-api-error-message {su/KeywordOrString (s/cond-pre s/Str s/Num)} {su/KeywordOrString s/Any})
(deferred-tru "value must be a map with each value either a string or number.")))
(def NewUser (def NewUser
"Required/optionals parameters needed to create a new user (for any backend)" "Required/optionals parameters needed to create a new user (for any backend)"
......
...@@ -182,6 +182,18 @@ ...@@ -182,6 +182,18 @@
(tt/with-temp User [user {:is_superuser true}] (tt/with-temp User [user {:is_superuser true}]
(db/exists? PermissionsGroupMembership :user_id (u/get-id user), :group_id (u/get-id (group/admin))))) (db/exists? PermissionsGroupMembership :user_id (u/get-id user), :group_id (u/get-id (group/admin)))))
;; You should be able to create a new LDAP user if some `login_attributes` are vectors (#10291)
(expect
{"local_birds" ["Steller's Jay" "Mountain Chickadee"]}
(try
(user/create-new-ldap-auth-user! {:email "ldaptest@metabase.com"
:first_name "Test"
:last_name "SomeLdapStuff"
:login_attributes {:local_birds ["Steller's Jay" "Mountain Chickadee"]}})
(db/select-one-field :login_attributes User :email "ldaptest@metabase.com")
(finally
(db/delete! User :email "ldaptest@metabase.com"))))
;;; +----------------------------------------------------------------------------------------------------------------+ ;;; +----------------------------------------------------------------------------------------------------------------+
;;; | New Group IDs Functions | ;;; | New Group IDs Functions |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment