Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove user id from reference #31

Merged
merged 1 commit into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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