Stars: implement full CRUD operations via legacy service (#110489)

This commit is contained in:
Ryan McKinley
2025-09-04 14:49:49 -05:00
committed by GitHub
parent 1dadf2cad9
commit 4723d2d8de
9 changed files with 543 additions and 49 deletions
+2 -2
View File
@@ -25,11 +25,11 @@ func (o OwnerReference) AsName() string {
if o.Name == "" || o.Owner == NamespaceResourceOwner {
return string(o.Owner)
}
return string(o.Owner) + ":" + o.Name
return string(o.Owner) + "-" + o.Name
}
func ParseOwnerFromName(name string) (OwnerReference, bool) {
before, after, found := strings.Cut(name, ":")
before, after, found := strings.Cut(name, "-")
if found && len(after) > 0 {
switch before {
case "user":
@@ -17,31 +17,31 @@ func TestLegacyAuthorizer(t *testing.T) {
}{
{
name: "invalid",
input: "xxx:yyy",
input: "xxx-yyy",
output: utils.OwnerReference{},
found: false,
},
{
name: "with user",
input: "user:a",
input: "user-a",
output: utils.OwnerReference{Owner: utils.UserResourceOwner, Name: "a"},
found: true,
},
{
name: "missing user",
input: "user:",
input: "user-",
output: utils.OwnerReference{},
found: false,
},
{
name: "with team",
input: "team:b",
input: "team-b",
output: utils.OwnerReference{Owner: utils.TeamResourceOwner, Name: "b"},
found: true,
},
{
name: "missing team",
input: "team:",
input: "team-",
output: utils.OwnerReference{},
found: false,
},