Skip to content

Conversation

migmartri
Copy link
Member

Being able to update an existing organization name that the user is a member of.

This patch also adds some logic to perform the same validation Kubernetes has for the namespace names.

The reason to perform this validation is that later down the road, we'll add additional constraints to make sure the names are unique across the instance, can be used as part of a URL, and it can become an identifier on a declarative API.

Closes #448

Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
message Result {
User current_user = 1;
Org current_org = 2;
OrgItem current_org = 2;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change it just to be consistent with the name of other resources in the proto defs

service OrganizationService {
// List the organizations this user has access to
rpc ListMemberships (OrganizationServiceListMembershipsRequest) returns (OrganizationServiceListMembershipsResponse);
rpc Update (OrganizationServiceUpdateRequest) returns (OrganizationServiceUpdateResponse);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the actual new method

return uc.orgRepo.Create(ctx, name)
}

func validateOrgName(name string) error {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the new validation logic performed on creation and update.

Note that selecting the name on creation is not yet supported, but will.

That's why for the auto-generated names we make sure it complies with this new format.

Copy link
Member

@danlishka danlishka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@migmartri migmartri merged commit 04c1ff4 into chainloop-dev:main Nov 30, 2023
@migmartri migmartri deleted the update-org branch November 30, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update organizaton
2 participants