sync_attr_with_auth0 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2441467a77240b5be6d8fe7f33dfa57b5b3521945606c47803f928124b3b70f
|
4
|
+
data.tar.gz: 0231f6a6f5864485447a81c3c7e2c9e49beeb3d8def264e23f3a2cf5d863e7d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b3328e06d33cc34c39e4367b41ebfb13475679c3f9c4137c9a996b6a450396bfef27921b5ae7c29780af36cceeb92612a706e63f7043a01eae8b8f00174ca4
|
7
|
+
data.tar.gz: 40381d9b91a763b6a7722ce7da08192d0008eeb0bef7329129e473a977808e0cb7538df22ed061945e67ff5dc207cec5572c2c473f33e01484ed1f2e634f8d93
|
@@ -105,10 +105,8 @@ module SyncAttrWithAuth0
|
|
105
105
|
def update_in_auth0(user_uid)
|
106
106
|
return unless user_uid
|
107
107
|
|
108
|
-
params = auth0_update_params
|
109
|
-
|
110
108
|
begin
|
111
|
-
response = SyncAttrWithAuth0::Auth0.patch_user(user_uid,
|
109
|
+
response = SyncAttrWithAuth0::Auth0.patch_user(user_uid, auth0_update_params(user_uid), config: auth0_sync_configuration)
|
112
110
|
|
113
111
|
# Update the record with the uid after_commit (in case it doesn't match what's on file).
|
114
112
|
@auth0_uid = user_uid
|
@@ -125,7 +123,7 @@ module SyncAttrWithAuth0
|
|
125
123
|
else
|
126
124
|
# The uid was incorrect, so re-attempt with the new uid
|
127
125
|
# and update the one on file.
|
128
|
-
response = SyncAttrWithAuth0::Auth0.patch_user(found_user['user_id'],
|
126
|
+
response = SyncAttrWithAuth0::Auth0.patch_user(found_user['user_id'], auth0_update_params(found_user['user_id']), config: auth0_sync_configuration)
|
129
127
|
|
130
128
|
# Update the record with the uid after_commit
|
131
129
|
@auth0_uid = found_user['user_id']
|
@@ -171,19 +169,24 @@ module SyncAttrWithAuth0
|
|
171
169
|
end # auth0_create_params
|
172
170
|
|
173
171
|
|
174
|
-
def auth0_update_params
|
172
|
+
def auth0_update_params(user_uid)
|
175
173
|
user_metadata = auth0_user_metadata
|
176
174
|
app_metadata = auth0_app_metadata
|
175
|
+
is_auth0_connection_strategy = user_uid.start_with?("auth0|")
|
177
176
|
|
178
177
|
params = {
|
179
|
-
'name' => auth0_user_name,
|
180
|
-
'nickname' => auth0_user_name,
|
181
|
-
'given_name' => auth0_user_given_name,
|
182
|
-
'family_name' => auth0_user_family_name,
|
183
178
|
'app_metadata' => app_metadata,
|
184
179
|
'user_metadata' => user_metadata
|
185
180
|
}
|
186
181
|
|
182
|
+
if is_auth0_connection_strategy
|
183
|
+
# We can update the name attributes on Auth0 connection strategy only.
|
184
|
+
params['name'] = auth0_user_name
|
185
|
+
params['nickname'] = auth0_user_name
|
186
|
+
params['given_name'] = auth0_user_given_name
|
187
|
+
params['family_name'] = auth0_user_family_name
|
188
|
+
end
|
189
|
+
|
187
190
|
if auth0_user_saved_change_to_password?
|
188
191
|
# The password needs to be updated.
|
189
192
|
params['password'] = auth0_user_password
|