diff --git a/internal/db/dbrepo/mytokenrepo/tree/tree.go b/internal/db/dbrepo/mytokenrepo/tree/tree.go index ea7d0db4508bd93a42b99e70d3e958400c0535c1..2384f787ab9bcb65a1883e1891347e6351ee5a9a 100644 --- a/internal/db/dbrepo/mytokenrepo/tree/tree.go +++ b/internal/db/dbrepo/mytokenrepo/tree/tree.go @@ -25,7 +25,7 @@ type MytokenEntry struct { // MytokenEntryTree is a tree of MytokenEntry type MytokenEntryTree struct { - Token MytokenEntry `json:"token"` + Token *MytokenEntry `json:"token"` Children []MytokenEntryTree `json:"children,omitempty"` } @@ -64,7 +64,7 @@ func TokenSubTree(rlog log.Ext1FieldLogger, tx *sqlx.Tx, tokenID mtid.MTID) (Myt break } } - tree, _ := tokensToTree(root, tokens) + tree, _ := tokensToTree(&root, tokens) return tree, nil } @@ -81,26 +81,26 @@ func tokensToTrees(tokens []MytokenEntry) (trees []MytokenEntryTree) { } var tmp MytokenEntryTree for _, r := range roots { - tmp, tokens = tokensToTree(r, tokens) + tmp, tokens = tokensToTree(&r, tokens) trees = append(trees, tmp) } return } -func tokensToTree(root MytokenEntry, tokens []MytokenEntry) (MytokenEntryTree, []MytokenEntry) { +func tokensToTree(root *MytokenEntry, tokens []MytokenEntry) (MytokenEntryTree, []MytokenEntry) { tree := MytokenEntryTree{ Token: root, } children := popChildren(root, &tokens) var cTree MytokenEntryTree for _, c := range children { - cTree, tokens = tokensToTree(c, tokens) + cTree, tokens = tokensToTree(&c, tokens) tree.Children = append(tree.Children, cTree) } return tree, tokens } -func popChildren(root MytokenEntry, tokens *[]MytokenEntry) (children []MytokenEntry) { +func popChildren(root *MytokenEntry, tokens *[]MytokenEntry) (children []MytokenEntry) { i := 0 for i < len(*tokens) { t := (*tokens)[i] diff --git a/internal/endpoints/consent/pkg/capability.go b/internal/endpoints/consent/pkg/capability.go index 9cb3a13c2894d2e16db85aec9d7117fd202e8bf0..8cbcf263f4cf95580487b1d39c9ec716a82fb248 100644 --- a/internal/endpoints/consent/pkg/capability.go +++ b/internal/endpoints/consent/pkg/capability.go @@ -168,11 +168,13 @@ func (c webCapability) getDangerLevel() int { } // ColorClass returns the html class for coloring this Capability +// skipcq: CRT-P0003 func (c webCapability) ColorClass() string { return textColorByDanger(c.getDangerLevel()) } // CapabilityLevel returns a string describing the power of this capability +// skipcq: CRT-P0003 func (c webCapability) CapabilityLevel() string { intClass := c.getIntClass() switch intClass { @@ -187,6 +189,7 @@ func (c webCapability) CapabilityLevel() string { } // IsCreateMT checks if this WebCapability is api.CapabilityCreateMT +// skipcq: CRT-P0003 func (c WebCapability) IsCreateMT() bool { return c.ReadWriteCapability.Name == api.CapabilityCreateMT.Name }