Skip to content

Commit

Permalink
Merge pull request #31 from appuio/breaking/remove-userid
Browse files Browse the repository at this point in the history
Remove user id from reference
  • Loading branch information
glrf authored Feb 7, 2022
2 parents 1728a69 + 878bdd3 commit 9d29950
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions apis/v1/organizationmembers_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions apis/v1/user_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
2 changes: 1 addition & 1 deletion apiserver/organization/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
}

Expand Down
2 changes: 1 addition & 1 deletion apiserver/organization/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ spec:
items:
description: UserRef points to a user
properties:
id:
type: string
username:
name:
type: string
type: object
type: array
Expand All @@ -56,9 +54,7 @@ spec:
items:
description: UserRef points to a user
properties:
id:
type: string
username:
name:
type: string
type: object
type: array
Expand Down
2 changes: 2 additions & 0 deletions config/crd/apiextensions.k8s.io/v1/base/appuio.io_users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ spec:
type: string
email:
type: string
id:
type: string
username:
type: string
type: object
Expand Down

0 comments on commit 9d29950

Please sign in to comment.