mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
[bug] unable to bind sso to Profile.bithday or Profile.gender
This commit is contained in:
parent
587beb01ab
commit
3fb9850786
@ -27,7 +27,8 @@ class Profile < ApplicationRecord
|
|||||||
# we protect some fields as they are designed to be managed by the system and must not be updated externally
|
# we protect some fields as they are designed to be managed by the system and must not be updated externally
|
||||||
blacklist = %w[id user_id created_at updated_at]
|
blacklist = %w[id user_id created_at updated_at]
|
||||||
# model-relationships must be added manually
|
# model-relationships must be added manually
|
||||||
additional = [%w[avatar string], %w[address string], %w[organization_name string], %w[organization_address string]]
|
additional = [%w[avatar string], %w[address string], %w[organization_name string], %w[organization_address string],
|
||||||
|
%w[gender boolean], %w[birthday date]]
|
||||||
Profile.columns_hash
|
Profile.columns_hash
|
||||||
.map { |k, v| [k, v.type.to_s] }
|
.map { |k, v| [k, v.type.to_s] }
|
||||||
.delete_if { |col| blacklist.include?(col[0]) }
|
.delete_if { |col| blacklist.include?(col[0]) }
|
||||||
|
@ -242,6 +242,10 @@ class User < ApplicationRecord
|
|||||||
invoicing_profile.organization.name
|
invoicing_profile.organization.name
|
||||||
when 'profile.organization_address'
|
when 'profile.organization_address'
|
||||||
invoicing_profile.organization.address.address
|
invoicing_profile.organization.address.address
|
||||||
|
when 'profile.gender'
|
||||||
|
statistic_profile.gender
|
||||||
|
when 'profile.birthday'
|
||||||
|
statistic_profile.birthday
|
||||||
else
|
else
|
||||||
profile[parsed[2].to_sym]
|
profile[parsed[2].to_sym]
|
||||||
end
|
end
|
||||||
@ -269,6 +273,12 @@ class User < ApplicationRecord
|
|||||||
invoicing_profile.organization ||= Organization.new
|
invoicing_profile.organization ||= Organization.new
|
||||||
invoicing_profile.organization.address ||= Address.new
|
invoicing_profile.organization.address ||= Address.new
|
||||||
invoicing_profile.organization.address.address = data
|
invoicing_profile.organization.address.address = data
|
||||||
|
when 'profile.gender'
|
||||||
|
statistic_profile ||= StatisticProfile.new
|
||||||
|
statistic_profile.gender = data
|
||||||
|
when 'profile.birthday'
|
||||||
|
statistic_profile ||= StatisticProfile.new
|
||||||
|
statistic_profile.birthday = data
|
||||||
else
|
else
|
||||||
profile[sso_mapping[8..-1].to_sym] = data unless data.nil?
|
profile[sso_mapping[8..-1].to_sym] = data unless data.nil?
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
json.user User.mapping
|
json.user User.mapping
|
||||||
|
json.profile Profile.mapping
|
||||||
json.profile Profile.mapping
|
|
||||||
|
Loading…
Reference in New Issue
Block a user