forked from baron/baron-sso
조직도 표현 개선
This commit is contained in:
@@ -156,7 +156,7 @@ type orgContextMember struct {
|
||||
Position string `json:"position,omitempty"`
|
||||
JobTitle string `json:"jobTitle,omitempty"`
|
||||
IsOwner bool `json:"isOwner"`
|
||||
IsLeader bool `json:"isLeader"`
|
||||
IsManager bool `json:"isManager"`
|
||||
IsPrimary bool `json:"isPrimary"`
|
||||
}
|
||||
|
||||
@@ -2412,12 +2412,12 @@ func mapOrgContextMember(user domain.User, appointment map[string]any, includeUs
|
||||
department = value
|
||||
}
|
||||
isOwner := false
|
||||
if value, ok := metadataBoolFromMap(appointment, "isOwner", "isManager"); ok {
|
||||
if value, ok := metadataBoolFromMap(appointment, "isOwner"); ok {
|
||||
isOwner = value
|
||||
}
|
||||
isLeader := isOwner
|
||||
if value, ok := metadataBoolFromMap(appointment, "lead", "isLead"); ok {
|
||||
isLeader = value
|
||||
isManager := false
|
||||
if value, ok := metadataBoolFromMap(appointment, "isManager", "lead", "isLead"); ok {
|
||||
isManager = value
|
||||
}
|
||||
isPrimary := false
|
||||
if value, ok := metadataBoolFromMap(appointment, "representative", "isPrimary", "primary"); ok {
|
||||
@@ -2439,7 +2439,7 @@ func mapOrgContextMember(user domain.User, appointment map[string]any, includeUs
|
||||
Position: position,
|
||||
JobTitle: jobTitle,
|
||||
IsOwner: isOwner,
|
||||
IsLeader: isLeader,
|
||||
IsManager: isManager,
|
||||
IsPrimary: isPrimary,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ func TestTenantHandler_GetOrgContextJSONDefaultsToHanmacFamilyForApiKey(t *testi
|
||||
"additionalAppointments": []any{
|
||||
map[string]any{
|
||||
"tenantSlug": "sso",
|
||||
"lead": true,
|
||||
"isManager": true,
|
||||
"position": "파트장",
|
||||
},
|
||||
},
|
||||
@@ -743,8 +743,9 @@ func TestTenantHandler_GetOrgContextJSONDefaultsToHanmacFamilyForApiKey(t *testi
|
||||
require.Equal(t, "lead@example.com", firstUser["email"])
|
||||
require.Equal(t, "플랫폼 리드", firstUser["name"])
|
||||
require.Equal(t, true, firstUser["isOwner"])
|
||||
require.Equal(t, true, firstUser["isLeader"])
|
||||
require.Equal(t, false, firstUser["isManager"])
|
||||
require.Equal(t, true, firstUser["isPrimary"])
|
||||
require.NotContains(t, firstUser, "isLeader")
|
||||
require.Equal(t, "수석", firstUser["grade"])
|
||||
require.Equal(t, "실장", firstUser["position"])
|
||||
require.Equal(t, "기술기획", firstUser["jobTitle"])
|
||||
@@ -754,7 +755,8 @@ func TestTenantHandler_GetOrgContextJSONDefaultsToHanmacFamilyForApiKey(t *testi
|
||||
appointmentOnly := ssoMembers[0].(map[string]any)
|
||||
require.Equal(t, "appointment@example.com", appointmentOnly["email"])
|
||||
require.Equal(t, false, appointmentOnly["isOwner"])
|
||||
require.Equal(t, true, appointmentOnly["isLeader"])
|
||||
require.Equal(t, true, appointmentOnly["isManager"])
|
||||
require.NotContains(t, appointmentOnly, "isLeader")
|
||||
|
||||
tree := got["tree"].(map[string]any)
|
||||
require.Equal(t, "group-hanmac-family", tree["id"])
|
||||
|
||||
@@ -191,8 +191,8 @@ func BuildWorksmobileUserPayloadForDomainTenants(user domain.User, tenant domain
|
||||
type worksmobileAppointment struct {
|
||||
TenantID string
|
||||
IsPrimary bool
|
||||
IsOwner bool
|
||||
HasOwner bool
|
||||
IsManager bool
|
||||
HasManager bool
|
||||
JobTitle string
|
||||
PositionID string
|
||||
}
|
||||
@@ -247,8 +247,8 @@ func buildWorksmobileUserOrganizations(user domain.User, tenant domain.Tenant, t
|
||||
Primary: appointment.IsPrimary,
|
||||
PositionID: appointment.PositionID,
|
||||
}
|
||||
if appointment.HasOwner {
|
||||
isManager := appointment.IsOwner
|
||||
if appointment.HasManager {
|
||||
isManager := appointment.IsManager
|
||||
orgUnit.IsManager = &isManager
|
||||
}
|
||||
organizations = append(organizations, WorksmobileUserOrganization{
|
||||
@@ -285,9 +285,9 @@ func worksmobileAppointmentsFromMetadata(metadata domain.JSONMap) []worksmobileA
|
||||
JobTitle: metadataString(domain.JSONMap(item), "jobTitle", "job_title", "task"),
|
||||
PositionID: metadataString(domain.JSONMap(item), "worksmobilePositionId", "positionId", "position_id"),
|
||||
}
|
||||
if isOwner, ok := metadataOptionalBool(domain.JSONMap(item), "isOwner", "isManager"); ok {
|
||||
appointment.IsOwner = isOwner
|
||||
appointment.HasOwner = true
|
||||
if isManager, ok := metadataOptionalBool(domain.JSONMap(item), "isManager", "lead", "isLead"); ok {
|
||||
appointment.IsManager = isManager
|
||||
appointment.HasManager = true
|
||||
}
|
||||
appointments = append(appointments, appointment)
|
||||
}
|
||||
|
||||
@@ -150,14 +150,14 @@ func TestBuildWorksmobileUserPayloadMapsAdditionalAppointmentsToOrgUnits(t *test
|
||||
map[string]any{
|
||||
"tenantId": secondaryTenantID,
|
||||
"isPrimary": false,
|
||||
"isOwner": true,
|
||||
"isManager": true,
|
||||
"jobTitle": "PM",
|
||||
"position": "팀장",
|
||||
},
|
||||
map[string]any{
|
||||
"tenantId": primaryTenantID,
|
||||
"isPrimary": true,
|
||||
"isOwner": false,
|
||||
"isOwner": true,
|
||||
"jobTitle": "Engineering",
|
||||
"position": "책임",
|
||||
},
|
||||
@@ -194,8 +194,7 @@ func TestBuildWorksmobileUserPayloadMapsAdditionalAppointmentsToOrgUnits(t *test
|
||||
require.True(t, payload.Organizations[0].Primary)
|
||||
require.Equal(t, "externalKey:"+primaryTenantID, payload.Organizations[0].OrgUnits[0].OrgUnitID)
|
||||
require.True(t, payload.Organizations[0].OrgUnits[0].Primary)
|
||||
require.NotNil(t, payload.Organizations[0].OrgUnits[0].IsManager)
|
||||
require.False(t, *payload.Organizations[0].OrgUnits[0].IsManager)
|
||||
require.Nil(t, payload.Organizations[0].OrgUnits[0].IsManager)
|
||||
require.Equal(t, int64(1002), payload.Organizations[1].DomainID)
|
||||
require.False(t, payload.Organizations[1].Primary)
|
||||
require.Equal(t, "externalKey:"+secondaryTenantID, payload.Organizations[1].OrgUnits[0].OrgUnitID)
|
||||
|
||||
Reference in New Issue
Block a user