@@ -280,6 +280,7 @@ func normalizeFramework(framework *string) string {
280280 return customFramework
281281}
282282
283+ // getControlMappings returns the controls and subcontrols mapped to a control based on the ref code and framework
283284func getControlMappings (ctx context.Context , refCode string , framework * string , parentControlID * string ) ([]* generated.MappedControl , error ) {
284285 fullWhere , err := prepMappedControlQuery (ctx , refCode , framework , parentControlID )
285286 if err != nil {
@@ -299,6 +300,7 @@ func getControlMappings(ctx context.Context, refCode string, framework *string,
299300 return res , nil
300301}
301302
303+ // getSubcontrolMappings returns the controls and subcontrols mapped to a subcontrol based on the ref code and framework
302304func getSubcontrolMappings (ctx context.Context , refCode string , framework * string , parentControlID * string ) ([]* generated.MappedControl , error ) {
303305 fullWhere , err := prepMappedControlQuery (ctx , refCode , framework , parentControlID )
304306 if err != nil {
@@ -318,6 +320,7 @@ func getSubcontrolMappings(ctx context.Context, refCode string, framework *strin
318320 return res , nil
319321}
320322
323+ // prepMappedControlQuery gets the predicate for the mapped control query
321324func prepMappedControlQuery (ctx context.Context , refCode string , framework * string , parentControlID * string ) ([]predicate.MappedControl , error ) {
322325 // get orgs to filter, this will allow us to skip expensive authz checks
323326 orgIDs , err := auth .GetOrganizationIDsFromContext (ctx )
@@ -539,6 +542,7 @@ func findOrganizationSubcontrolForMapping(ctx context.Context, c *generated.Subc
539542 return mappedFromSystem , true
540543}
541544
545+ // isSameControl determines if the ref code is the same as the mapped control being checked
542546func isSameControl (refCode string , framework * string , mappedControl * generated.Control ) bool {
543547 if refCode != mappedControl .RefCode {
544548 return false
@@ -555,6 +559,7 @@ func isSameControl(refCode string, framework *string, mappedControl *generated.C
555559 return currentFramework == mappedFramework
556560}
557561
562+ // isSameSubcontrold etermines if the ref code is the same as the mapped subcontrol being checked
558563func isSameSubcontrol (refCode string , framework * string , mappedControl * generated.Subcontrol ) bool {
559564 if refCode != mappedControl .RefCode {
560565 return false
0 commit comments