fix resource owner display on backup list (#1580)

## Type of change

- [x] 🐛 Bugfix

## Issue(s)

* #1506

## Test Plan

- [x]  Unit test
This commit is contained in:
Keepers 2022-11-22 09:37:48 -07:00 committed by GitHub
parent f3980f6bc9
commit 5f82edb783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View File

@ -296,8 +296,8 @@ func resourcesShortFormat(m map[string][]string) string {
}
// Transforms the slice to a single map.
// Keys are each map's scopeKeyResource value.
// Values are the set of all scopeKeyDataTypes for a given resource.
// Keys are each service's rootCat value.
// Values are the set of all scopeKeyDataTypes for the resource.
func toResourceTypeMap[T scopeT](s []scope) map[string][]string {
if len(s) == 0 {
return nil
@ -314,7 +314,9 @@ func toResourceTypeMap[T scopeT](s []scope) map[string][]string {
k = All
}
r[k] = addToSet(r[k], split(sc[scopeKeyDataType].Target))
for _, sk := range split(k) {
r[sk] = addToSet(r[sk], split(sc[scopeKeyDataType].Target))
}
}
return r

View File

@ -106,6 +106,21 @@ func (suite *SelectorSuite) TestToResourceTypeMap() {
"smarf": {unknownCatStub.String()},
},
},
{
name: "multiple resources",
input: []scope{
scope(stubScope("")),
{
rootCatStub.String(): filterize(scopeConfig{}, join("smarf", "fnords")),
scopeKeyDataType: filterize(scopeConfig{}, unknownCatStub.String()),
},
},
expect: map[string][]string{
"All": {rootCatStub.String()},
"smarf": {unknownCatStub.String()},
"fnords": {unknownCatStub.String()},
},
},
{
name: "disjoint types",
input: []scope{