fix: system admin is always a tag owner

This commit is contained in:
Johan Siebens
2022-09-17 07:13:06 +02:00
parent b265fc42c7
commit b65119bbba
2 changed files with 10 additions and 3 deletions
+3 -3
View File
@@ -59,10 +59,10 @@ func (a ACLPolicy) CheckTagOwners(tags []string, p *User) error {
}
func (a ACLPolicy) IsTagOwner(tag string, p *User) bool {
if p.UserType == UserTypeService {
return true
}
if tagOwners, ok := a.TagOwners[tag]; ok {
if p.UserType == UserTypeService {
return true
}
return a.validateTagOwners(tagOwners, p)
}
return false
+7
View File
@@ -28,6 +28,13 @@ func TestACLPolicy_IsTagOwner(t *testing.T) {
userType: UserTypeService,
expectErr: false,
},
{
name: "system admin is always a valid owner",
tag: "tag:unknown",
userName: "system admin",
userType: UserTypeService,
expectErr: false,
},
{
name: "direct tag owner",
tag: "tag:web",