1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(feat) map external id from sso

This commit is contained in:
Sylvain 2023-01-19 17:33:48 +01:00
parent 91dd7b174e
commit f204f654c2
3 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@
- Add more context data to sentry reports
- Improved SSO testing
- Ability to map the external ID from the SSO
- Fix a bug: unable to run task fix_invoice_item when some invoice items are associated with errors
- Fix a bug: invalid event date reported when the timezone in before UTC
- Fix a bug: unable to run accounting export if a line label was not defined

View File

@ -28,7 +28,7 @@ class Profile < ApplicationRecord
blacklist = %w[id user_id created_at updated_at]
# model-relationships must be added manually
additional = [%w[avatar string], %w[address string], %w[organization_name string], %w[organization_address string],
%w[gender boolean], %w[birthday date]]
%w[gender boolean], %w[birthday date], %w[external_id string]]
Profile.columns_hash
.map { |k, v| [k, v.type.to_s] }
.delete_if { |col| blacklist.include?(col[0]) }

View File

@ -40,6 +40,11 @@ class UserSetterService
@user.statistic_profile.birthday = data
end
def assign_external_id(data)
@user.invoicing_profile ||= InvoicingProfile.new
@user.invoicing_profile.external_id = data
end
def assign_profile_attribute(attribute, data)
@user.profile[attribute[8..].to_sym] = data
end
@ -65,6 +70,8 @@ class UserSetterService
assign_gender(data)
when 'profile.birthday'
assign_birthday(data)
when 'profile.external_id'
assign_external_id(data)
else
assign_profile_attribute(attribute, data)
end