Fix MS365 attributes handling
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
4
go.mod
4
go.mod
@@ -14,7 +14,6 @@ require (
|
||||
github.com/chromedp/chromedp v0.14.2
|
||||
github.com/crewjam/saml v0.5.1
|
||||
github.com/digitorus/timestamp v0.0.0-20250524132541-c45532741eea
|
||||
github.com/elimity-com/scim v0.0.0-20240320110924-172bf2aee9c8
|
||||
github.com/go-chi/chi/v5 v5.2.5
|
||||
github.com/go-chi/cors v1.2.2
|
||||
github.com/jackc/pgx/v5 v5.8.0
|
||||
@@ -70,6 +69,7 @@ require (
|
||||
github.com/di-wu/xsd-datetime v1.0.0 // indirect
|
||||
github.com/digitorus/pkcs7 v0.0.0-20230713084857-e76b763bdc49 // indirect
|
||||
github.com/dnephin/pflag v1.0.7 // indirect
|
||||
github.com/elimity-com/scim v0.0.0-20240320110924-172bf2aee9c8
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
@@ -155,3 +155,5 @@ tool (
|
||||
)
|
||||
|
||||
replace github.com/olekukonko/tablewriter => github.com/olekukonko/tablewriter v0.0.5
|
||||
|
||||
replace github.com/elimity-com/scim => github.com/getprobo/scim v0.0.0-20260309220528-a952b258e8d3
|
||||
|
||||
4
go.sum
4
go.sum
@@ -83,14 +83,14 @@ github.com/digitorus/timestamp v0.0.0-20250524132541-c45532741eea h1:ALRwvjsSP53
|
||||
github.com/digitorus/timestamp v0.0.0-20250524132541-c45532741eea/go.mod h1:GvWntX9qiTlOud0WkQ6ewFm0LPy5JUR1Xo0Ngbd1w6Y=
|
||||
github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk=
|
||||
github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE=
|
||||
github.com/elimity-com/scim v0.0.0-20240320110924-172bf2aee9c8 h1:0+BTyxIYgiVAry/P5s8R4dYuLkhB9Nhso8ogFWNr4IQ=
|
||||
github.com/elimity-com/scim v0.0.0-20240320110924-172bf2aee9c8/go.mod h1:JkjcmqbLW+khwt2fmBPJFBhx2zGZ8XobRZ+O0VhlwWo=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
|
||||
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||
github.com/getprobo/scim v0.0.0-20260309220528-a952b258e8d3 h1:bn2ml0JxH4DtQqi+CZ+ZPUBo1i3K+4xD0rHczpvpqFk=
|
||||
github.com/getprobo/scim v0.0.0-20260309220528-a952b258e8d3/go.mod h1:njybYNBd7EDyRMan05ticVQjPP6ThiuyCDbtRh9+e8A=
|
||||
github.com/go-chi/chi/v5 v5.2.5 h1:Eg4myHZBjyvJmAFjFvWgrqDTXFyOzjj7YIm3L3mu6Ug=
|
||||
github.com/go-chi/chi/v5 v5.2.5/go.mod h1:X7Gx4mteadT3eDOMTsXzmI4/rwUpOwBHLpAfupzFJP0=
|
||||
github.com/go-chi/cors v1.2.2 h1:Jmey33TE+b+rB7fT8MUy1u0I4L+NARQlK6LhzKPSyQE=
|
||||
|
||||
@@ -46,6 +46,23 @@ type (
|
||||
OrganizationName string `db:"organization_name"`
|
||||
UserName *string `db:"user_name"`
|
||||
ExternalID *string `db:"external_id"`
|
||||
NickName *string `db:"nick_name"`
|
||||
Locale *string `db:"locale"`
|
||||
Timezone *string `db:"timezone"`
|
||||
ProfileUrl *string `db:"profile_url"`
|
||||
PreferredLanguage *string `db:"preferred_language"`
|
||||
GivenName *string `db:"given_name"`
|
||||
FamilyName *string `db:"family_name"`
|
||||
FormattedName *string `db:"formatted_name"`
|
||||
MiddleName *string `db:"middle_name"`
|
||||
HonorificPrefix *string `db:"honorific_prefix"`
|
||||
HonorificSuffix *string `db:"honorific_suffix"`
|
||||
EmployeeNumber *string `db:"employee_number"`
|
||||
Department *string `db:"department"`
|
||||
CostCenter *string `db:"cost_center"`
|
||||
EnterpriseOrganization *string `db:"enterprise_organization"`
|
||||
Division *string `db:"division"`
|
||||
ManagerValue *string `db:"manager_value"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
@@ -111,6 +128,23 @@ SELECT
|
||||
'' AS organization_name,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM
|
||||
@@ -171,6 +205,23 @@ SELECT
|
||||
'' AS organization_name,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM
|
||||
@@ -234,6 +285,23 @@ SELECT
|
||||
'' AS organization_name,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM
|
||||
@@ -290,6 +358,23 @@ WITH profiles AS (
|
||||
p.contract_end_date,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM
|
||||
@@ -316,6 +401,23 @@ SELECT
|
||||
'' AS organization_name,
|
||||
user_name,
|
||||
external_id,
|
||||
nick_name,
|
||||
locale,
|
||||
timezone,
|
||||
profile_url,
|
||||
preferred_language,
|
||||
given_name,
|
||||
family_name,
|
||||
formatted_name,
|
||||
middle_name,
|
||||
honorific_prefix,
|
||||
honorific_suffix,
|
||||
employee_number,
|
||||
department,
|
||||
cost_center,
|
||||
enterprise_organization,
|
||||
division,
|
||||
manager_value,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM profiles
|
||||
@@ -369,6 +471,23 @@ WITH profiles AS (
|
||||
p.contract_end_date,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM
|
||||
@@ -394,6 +513,23 @@ SELECT
|
||||
o.name AS organization_name,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM profiles p
|
||||
@@ -446,6 +582,23 @@ WITH profiles AS (
|
||||
mp.contract_end_date,
|
||||
mp.user_name,
|
||||
mp.external_id,
|
||||
mp.nick_name,
|
||||
mp.locale,
|
||||
mp.timezone,
|
||||
mp.profile_url,
|
||||
mp.preferred_language,
|
||||
mp.given_name,
|
||||
mp.family_name,
|
||||
mp.formatted_name,
|
||||
mp.middle_name,
|
||||
mp.honorific_prefix,
|
||||
mp.honorific_suffix,
|
||||
mp.employee_number,
|
||||
mp.department,
|
||||
mp.cost_center,
|
||||
mp.enterprise_organization,
|
||||
mp.division,
|
||||
mp.manager_value,
|
||||
mp.created_at,
|
||||
mp.updated_at
|
||||
FROM
|
||||
@@ -475,6 +628,23 @@ SELECT
|
||||
'' AS organization_name,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM profiles p
|
||||
@@ -556,6 +726,23 @@ WITH profiles AS (
|
||||
mp.contract_end_date,
|
||||
mp.user_name,
|
||||
mp.external_id,
|
||||
mp.nick_name,
|
||||
mp.locale,
|
||||
mp.timezone,
|
||||
mp.profile_url,
|
||||
mp.preferred_language,
|
||||
mp.given_name,
|
||||
mp.family_name,
|
||||
mp.formatted_name,
|
||||
mp.middle_name,
|
||||
mp.honorific_prefix,
|
||||
mp.honorific_suffix,
|
||||
mp.employee_number,
|
||||
mp.department,
|
||||
mp.cost_center,
|
||||
mp.enterprise_organization,
|
||||
mp.division,
|
||||
mp.manager_value,
|
||||
mp.created_at,
|
||||
mp.updated_at
|
||||
FROM
|
||||
@@ -585,6 +772,23 @@ SELECT
|
||||
'' AS organization_name,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM profiles p
|
||||
@@ -667,6 +871,23 @@ WITH attendees AS (
|
||||
p.contract_end_date,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at,
|
||||
ma.created_at AS attendee_created_at
|
||||
@@ -695,6 +916,23 @@ SELECT
|
||||
'' AS organization_name,
|
||||
user_name,
|
||||
external_id,
|
||||
nick_name,
|
||||
locale,
|
||||
timezone,
|
||||
profile_url,
|
||||
preferred_language,
|
||||
given_name,
|
||||
family_name,
|
||||
formatted_name,
|
||||
middle_name,
|
||||
honorific_prefix,
|
||||
honorific_suffix,
|
||||
employee_number,
|
||||
department,
|
||||
cost_center,
|
||||
enterprise_organization,
|
||||
division,
|
||||
manager_value,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
@@ -758,6 +996,23 @@ SELECT
|
||||
'' AS organization_name,
|
||||
p.user_name,
|
||||
p.external_id,
|
||||
p.nick_name,
|
||||
p.locale,
|
||||
p.timezone,
|
||||
p.profile_url,
|
||||
p.preferred_language,
|
||||
p.given_name,
|
||||
p.family_name,
|
||||
p.formatted_name,
|
||||
p.middle_name,
|
||||
p.honorific_prefix,
|
||||
p.honorific_suffix,
|
||||
p.employee_number,
|
||||
p.department,
|
||||
p.cost_center,
|
||||
p.enterprise_organization,
|
||||
p.division,
|
||||
p.manager_value,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM
|
||||
@@ -913,6 +1168,23 @@ INSERT INTO
|
||||
contract_end_date,
|
||||
user_name,
|
||||
external_id,
|
||||
nick_name,
|
||||
locale,
|
||||
timezone,
|
||||
profile_url,
|
||||
preferred_language,
|
||||
given_name,
|
||||
family_name,
|
||||
formatted_name,
|
||||
middle_name,
|
||||
honorific_prefix,
|
||||
honorific_suffix,
|
||||
employee_number,
|
||||
department,
|
||||
cost_center,
|
||||
enterprise_organization,
|
||||
division,
|
||||
manager_value,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
@@ -931,6 +1203,23 @@ VALUES (
|
||||
@contract_end_date,
|
||||
@user_name,
|
||||
@external_id,
|
||||
@nick_name,
|
||||
@locale,
|
||||
@timezone,
|
||||
@profile_url,
|
||||
@preferred_language,
|
||||
@given_name,
|
||||
@family_name,
|
||||
@formatted_name,
|
||||
@middle_name,
|
||||
@honorific_prefix,
|
||||
@honorific_suffix,
|
||||
@employee_number,
|
||||
@department,
|
||||
@cost_center,
|
||||
@enterprise_organization,
|
||||
@division,
|
||||
@manager_value,
|
||||
@created_at,
|
||||
@updated_at
|
||||
)
|
||||
@@ -950,7 +1239,24 @@ VALUES (
|
||||
"contract_start_date": p.ContractStartDate,
|
||||
"contract_end_date": p.ContractEndDate,
|
||||
"user_name": p.UserName,
|
||||
"external_id": p.ExternalID,
|
||||
"external_id": p.ExternalID,
|
||||
"nick_name": p.NickName,
|
||||
"locale": p.Locale,
|
||||
"timezone": p.Timezone,
|
||||
"profile_url": p.ProfileUrl,
|
||||
"preferred_language": p.PreferredLanguage,
|
||||
"given_name": p.GivenName,
|
||||
"family_name": p.FamilyName,
|
||||
"formatted_name": p.FormattedName,
|
||||
"middle_name": p.MiddleName,
|
||||
"honorific_prefix": p.HonorificPrefix,
|
||||
"honorific_suffix": p.HonorificSuffix,
|
||||
"employee_number": p.EmployeeNumber,
|
||||
"department": p.Department,
|
||||
"cost_center": p.CostCenter,
|
||||
"enterprise_organization": p.EnterpriseOrganization,
|
||||
"division": p.Division,
|
||||
"manager_value": p.ManagerValue,
|
||||
"created_at": p.CreatedAt,
|
||||
"updated_at": p.UpdatedAt,
|
||||
}
|
||||
@@ -987,6 +1293,23 @@ SET
|
||||
contract_end_date = @contract_end_date,
|
||||
user_name = @user_name,
|
||||
external_id = @external_id,
|
||||
nick_name = @nick_name,
|
||||
locale = @locale,
|
||||
timezone = @timezone,
|
||||
profile_url = @profile_url,
|
||||
preferred_language = @preferred_language,
|
||||
given_name = @given_name,
|
||||
family_name = @family_name,
|
||||
formatted_name = @formatted_name,
|
||||
middle_name = @middle_name,
|
||||
honorific_prefix = @honorific_prefix,
|
||||
honorific_suffix = @honorific_suffix,
|
||||
employee_number = @employee_number,
|
||||
department = @department,
|
||||
cost_center = @cost_center,
|
||||
enterprise_organization = @enterprise_organization,
|
||||
division = @division,
|
||||
manager_value = @manager_value,
|
||||
updated_at = @updated_at
|
||||
WHERE
|
||||
id = @id
|
||||
@@ -1006,7 +1329,24 @@ WHERE
|
||||
"contract_start_date": p.ContractStartDate,
|
||||
"contract_end_date": p.ContractEndDate,
|
||||
"user_name": p.UserName,
|
||||
"external_id": p.ExternalID,
|
||||
"external_id": p.ExternalID,
|
||||
"nick_name": p.NickName,
|
||||
"locale": p.Locale,
|
||||
"timezone": p.Timezone,
|
||||
"profile_url": p.ProfileUrl,
|
||||
"preferred_language": p.PreferredLanguage,
|
||||
"given_name": p.GivenName,
|
||||
"family_name": p.FamilyName,
|
||||
"formatted_name": p.FormattedName,
|
||||
"middle_name": p.MiddleName,
|
||||
"honorific_prefix": p.HonorificPrefix,
|
||||
"honorific_suffix": p.HonorificSuffix,
|
||||
"employee_number": p.EmployeeNumber,
|
||||
"department": p.Department,
|
||||
"cost_center": p.CostCenter,
|
||||
"enterprise_organization": p.EnterpriseOrganization,
|
||||
"division": p.Division,
|
||||
"manager_value": p.ManagerValue,
|
||||
"updated_at": p.UpdatedAt,
|
||||
}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
@@ -20,13 +20,13 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
MembershipProfileKind uint8
|
||||
MembershipProfileKind string
|
||||
)
|
||||
|
||||
const (
|
||||
MembershipProfileKindEmployee MembershipProfileKind = iota
|
||||
MembershipProfileKindContractor
|
||||
MembershipProfileKindServiceAccount
|
||||
MembershipProfileKindEmployee MembershipProfileKind = "EMPLOYEE"
|
||||
MembershipProfileKindContractor MembershipProfileKind = "CONTRACTOR"
|
||||
MembershipProfileKindServiceAccount MembershipProfileKind = "SERVICE_ACCOUNT"
|
||||
)
|
||||
|
||||
func MembershipProfileKinds() []MembershipProfileKind {
|
||||
@@ -38,55 +38,30 @@ func MembershipProfileKinds() []MembershipProfileKind {
|
||||
}
|
||||
|
||||
func (mpk MembershipProfileKind) MarshalText() ([]byte, error) {
|
||||
return []byte(mpk.String()), nil
|
||||
return []byte(mpk), nil
|
||||
}
|
||||
|
||||
func (mpk *MembershipProfileKind) UnmarshalText(data []byte) error {
|
||||
val := string(data)
|
||||
|
||||
switch val {
|
||||
case MembershipProfileKindEmployee.String():
|
||||
*mpk = MembershipProfileKindEmployee
|
||||
case MembershipProfileKindContractor.String():
|
||||
*mpk = MembershipProfileKindContractor
|
||||
case MembershipProfileKindServiceAccount.String():
|
||||
*mpk = MembershipProfileKindServiceAccount
|
||||
default:
|
||||
return fmt.Errorf("invalid MembershipProfileKind value: %q", val)
|
||||
}
|
||||
|
||||
*mpk = MembershipProfileKind(data)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mpk MembershipProfileKind) String() string {
|
||||
var val string
|
||||
|
||||
switch mpk {
|
||||
case MembershipProfileKindEmployee:
|
||||
val = "EMPLOYEE"
|
||||
case MembershipProfileKindContractor:
|
||||
val = "CONTRACTOR"
|
||||
case MembershipProfileKindServiceAccount:
|
||||
val = "SERVICE_ACCOUNT"
|
||||
}
|
||||
|
||||
return val
|
||||
return string(mpk)
|
||||
}
|
||||
|
||||
func (mpk *MembershipProfileKind) Scan(value any) error {
|
||||
var val string
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
val = v
|
||||
*mpk = MembershipProfileKind(v)
|
||||
case []byte:
|
||||
val = string(v)
|
||||
*mpk = MembershipProfileKind(v)
|
||||
default:
|
||||
return fmt.Errorf("unsupported type for MembershipProfileKind: %T", value)
|
||||
}
|
||||
|
||||
return mpk.UnmarshalText([]byte(val))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mpk MembershipProfileKind) Value() (driver.Value, error) {
|
||||
return mpk.String(), nil
|
||||
return string(mpk), nil
|
||||
}
|
||||
|
||||
6
pkg/coredata/migrations/20260309T150000Z.sql
Normal file
6
pkg/coredata/migrations/20260309T150000Z.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
ALTER TABLE iam_membership_profiles
|
||||
ALTER COLUMN kind TYPE TEXT USING kind::TEXT,
|
||||
ADD COLUMN nick_name TEXT,
|
||||
ADD COLUMN locale TEXT,
|
||||
ADD COLUMN timezone TEXT,
|
||||
ADD COLUMN profile_url TEXT;
|
||||
14
pkg/coredata/migrations/20260309T160000Z.sql
Normal file
14
pkg/coredata/migrations/20260309T160000Z.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
ALTER TABLE iam_membership_profiles
|
||||
ADD COLUMN preferred_language TEXT,
|
||||
ADD COLUMN given_name TEXT,
|
||||
ADD COLUMN family_name TEXT,
|
||||
ADD COLUMN formatted_name TEXT,
|
||||
ADD COLUMN middle_name TEXT,
|
||||
ADD COLUMN honorific_prefix TEXT,
|
||||
ADD COLUMN honorific_suffix TEXT,
|
||||
ADD COLUMN employee_number TEXT,
|
||||
ADD COLUMN department TEXT,
|
||||
ADD COLUMN cost_center TEXT,
|
||||
ADD COLUMN enterprise_organization TEXT,
|
||||
ADD COLUMN division TEXT,
|
||||
ADD COLUMN manager_value TEXT;
|
||||
@@ -45,21 +45,12 @@ func UserSchema() schema.Schema {
|
||||
schema.ComplexParams{
|
||||
Name: "name",
|
||||
SubAttributes: []schema.SimpleParams{
|
||||
schema.SimpleStringParams(
|
||||
schema.StringParams{
|
||||
Name: "formatted",
|
||||
},
|
||||
),
|
||||
schema.SimpleStringParams(
|
||||
schema.StringParams{
|
||||
Name: "familyName",
|
||||
},
|
||||
),
|
||||
schema.SimpleStringParams(
|
||||
schema.StringParams{
|
||||
Name: "givenName",
|
||||
},
|
||||
),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "formatted"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "familyName"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "givenName"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "middleName"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "honorificPrefix"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "honorificSuffix"}),
|
||||
},
|
||||
},
|
||||
),
|
||||
@@ -75,30 +66,108 @@ func UserSchema() schema.Schema {
|
||||
Name: "emails",
|
||||
MultiValued: true,
|
||||
SubAttributes: []schema.SimpleParams{
|
||||
schema.SimpleStringParams(
|
||||
schema.StringParams{
|
||||
Name: "value",
|
||||
},
|
||||
),
|
||||
schema.SimpleStringParams(
|
||||
schema.StringParams{
|
||||
Name: "type",
|
||||
},
|
||||
),
|
||||
schema.SimpleBooleanParams(
|
||||
schema.BooleanParams{
|
||||
Name: "primary",
|
||||
},
|
||||
),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "value"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "type"}),
|
||||
schema.SimpleBooleanParams(schema.BooleanParams{Name: "primary"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "display"}),
|
||||
},
|
||||
},
|
||||
),
|
||||
schema.ComplexCoreAttribute(
|
||||
schema.ComplexParams{
|
||||
Name: "phoneNumbers",
|
||||
MultiValued: true,
|
||||
SubAttributes: []schema.SimpleParams{
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "value"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "type"}),
|
||||
schema.SimpleBooleanParams(schema.BooleanParams{Name: "primary"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "display"}),
|
||||
},
|
||||
},
|
||||
),
|
||||
schema.ComplexCoreAttribute(
|
||||
schema.ComplexParams{
|
||||
Name: "addresses",
|
||||
MultiValued: true,
|
||||
SubAttributes: []schema.SimpleParams{
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "formatted"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "streetAddress"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "locality"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "region"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "postalCode"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "country"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "type"}),
|
||||
schema.SimpleBooleanParams(schema.BooleanParams{Name: "primary"}),
|
||||
},
|
||||
},
|
||||
),
|
||||
schema.ComplexCoreAttribute(
|
||||
schema.ComplexParams{
|
||||
Name: "roles",
|
||||
MultiValued: true,
|
||||
SubAttributes: []schema.SimpleParams{
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "value"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "display"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "type"}),
|
||||
schema.SimpleBooleanParams(schema.BooleanParams{Name: "primary"}),
|
||||
},
|
||||
},
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(
|
||||
schema.StringParams{
|
||||
Name: "title",
|
||||
},
|
||||
),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "title"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "userType"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "nickName"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "preferredLanguage"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "locale"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "timezone"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleReferenceParams(schema.ReferenceParams{Name: "profileUrl"}),
|
||||
),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func EnterpriseUserSchema() schema.Schema {
|
||||
return schema.Schema{
|
||||
ID: "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
|
||||
Name: optional.NewString("EnterpriseUser"),
|
||||
Description: optional.NewString("Enterprise User Extension"),
|
||||
Attributes: []schema.CoreAttribute{
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "employeeNumber"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "costCenter"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "organization"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "division"}),
|
||||
),
|
||||
schema.SimpleCoreAttribute(
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "department"}),
|
||||
),
|
||||
schema.ComplexCoreAttribute(
|
||||
schema.ComplexParams{
|
||||
Name: "manager",
|
||||
SubAttributes: []schema.SimpleParams{
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "value"}),
|
||||
schema.SimpleReferenceParams(schema.ReferenceParams{Name: "$ref"}),
|
||||
schema.SimpleStringParams(schema.StringParams{Name: "displayName"}),
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/elimity-com/scim"
|
||||
scimerrors "github.com/elimity-com/scim/errors"
|
||||
"github.com/elimity-com/scim/optional"
|
||||
"github.com/elimity-com/scim/schema"
|
||||
scimfilter "github.com/scim2/filter-parser/v2"
|
||||
"go.gearno.de/kit/httpserver"
|
||||
"go.gearno.de/kit/log"
|
||||
@@ -71,6 +72,8 @@ func scimConfigFromContext(ctx context.Context) *coredata.SCIMConfiguration {
|
||||
|
||||
// NewSCIMServer creates a new SCIM server using elimity-com/scim
|
||||
func NewSCIMServer(h *SCIMHandler) http.Handler {
|
||||
schema.SetAllowStringValues(true)
|
||||
|
||||
resourceTypes := []scim.ResourceType{
|
||||
{
|
||||
ID: optional.NewString("User"),
|
||||
@@ -78,7 +81,10 @@ func NewSCIMServer(h *SCIMHandler) http.Handler {
|
||||
Endpoint: "/Users",
|
||||
Description: optional.NewString("User Account"),
|
||||
Schema: scimservice.UserSchema(),
|
||||
Handler: &scimResourceHandler{handler: h},
|
||||
SchemaExtensions: []scim.SchemaExtension{
|
||||
{Schema: scimservice.EnterpriseUserSchema()},
|
||||
},
|
||||
Handler: &scimResourceHandler{handler: h},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user