diff --git a/apis/v1/organizationmembers_type.go b/apis/v1/organizationmembers_type.go index 66c0274d..f673e110 100644 --- a/apis/v1/organizationmembers_type.go +++ b/apis/v1/organizationmembers_type.go @@ -28,8 +28,7 @@ type OrganizationMembersStatus struct { // UserRef points to a user type UserRef struct { - ID string `json:"id,omitempty"` - Username string `json:"username,omitempty"` + Name string `json:"name,omitempty"` } // +kubebuilder:object:root=true diff --git a/apis/v1/user_types.go b/apis/v1/user_types.go index 626689ca..4feb99e7 100644 --- a/apis/v1/user_types.go +++ b/apis/v1/user_types.go @@ -30,6 +30,7 @@ type UserPreferences struct { // UserStatus contains the acutal state of the user type UserStatus struct { DefaultOrganizationRef string `json:"defaultOrganization,omitempty"` + ID string `json:"id,omitempty"` DisplayName string `json:"displayName,omitempty"` Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` diff --git a/apiserver/organization/create.go b/apiserver/organization/create.go index 56699cfc..4618a858 100644 --- a/apiserver/organization/create.go +++ b/apiserver/organization/create.go @@ -70,7 +70,7 @@ func newOrganizationMembers(ctx context.Context, organization *orgv1.Organizatio user, ok := request.UserFrom(ctx) if ok { userRefs = append(userRefs, controlv1.UserRef{ - ID: strings.TrimPrefix(user.GetName(), usernamePrefix), + Name: strings.TrimPrefix(user.GetName(), usernamePrefix), }) } diff --git a/apiserver/organization/create_test.go b/apiserver/organization/create_test.go index 1ec0b1bb..bb3bf8fa 100644 --- a/apiserver/organization/create_test.go +++ b/apiserver/organization/create_test.go @@ -216,7 +216,7 @@ func (m memberMatcher) Matches(x interface{}) bool { if !ok { return ok } - return len(mem.Spec.UserRefs) > 0 && mem.Spec.UserRefs[0].ID == m.user && + return len(mem.Spec.UserRefs) > 0 && mem.Spec.UserRefs[0].Name == m.user && len(mem.OwnerReferences) > 0 && mem.OwnerReferences[0].Name == m.owner } diff --git a/config/crd/apiextensions.k8s.io/v1/base/appuio.io_organizationmembers.yaml b/config/crd/apiextensions.k8s.io/v1/base/appuio.io_organizationmembers.yaml index eee6739b..c0d65e88 100644 --- a/config/crd/apiextensions.k8s.io/v1/base/appuio.io_organizationmembers.yaml +++ b/config/crd/apiextensions.k8s.io/v1/base/appuio.io_organizationmembers.yaml @@ -41,9 +41,7 @@ spec: items: description: UserRef points to a user properties: - id: - type: string - username: + name: type: string type: object type: array @@ -56,9 +54,7 @@ spec: items: description: UserRef points to a user properties: - id: - type: string - username: + name: type: string type: object type: array diff --git a/config/crd/apiextensions.k8s.io/v1/base/appuio.io_users.yaml b/config/crd/apiextensions.k8s.io/v1/base/appuio.io_users.yaml index f0921360..9bdc3d1b 100644 --- a/config/crd/apiextensions.k8s.io/v1/base/appuio.io_users.yaml +++ b/config/crd/apiextensions.k8s.io/v1/base/appuio.io_users.yaml @@ -52,6 +52,8 @@ spec: type: string email: type: string + id: + type: string username: type: string type: object