Skip to content

Commit

Permalink
chore: rename method to GetRBACAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Sep 25, 2024
1 parent 25f05b2 commit 1d6a0ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
17 changes: 0 additions & 17 deletions models/accessors.go

This file was deleted.

12 changes: 6 additions & 6 deletions models/playbooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,37 +336,37 @@ func (p *PlaybookRun) String(db *gorm.DB) string {
return s
}

func (run *PlaybookRun) GetAccessors(db *gorm.DB) (AccessorObjects, error) {
var output []AccessorObject
func (run *PlaybookRun) GetRBACAttributes(db *gorm.DB) (map[string]any, error) {
output := map[string]any{}

var playbook Playbook
if err := db.First(&playbook, run.PlaybookID).Error; err != nil {
return nil, err
}
output = append(output, AccessorObject{Name: "playbook", Data: playbook})
output["playbook"] = playbook

if run.ComponentID != nil {
var component Component
if err := db.First(&component, run.ComponentID).Error; err != nil {
return nil, err
}
output = append(output, AccessorObject{Name: "component", Data: component})
output["component"] = component
}

if run.CheckID != nil {
var check Check
if err := db.First(&check, run.CheckID).Error; err != nil {
return nil, err
}
output = append(output, AccessorObject{Name: "check", Data: check})
output["check"] = check
}

if run.ConfigID != nil {
var config ConfigItem
if err := db.First(&config, run.ConfigID).Error; err != nil {
return nil, err
}
output = append(output, AccessorObject{Name: "config", Data: config})
output["config"] = config
}

return output, nil
Expand Down

0 comments on commit 1d6a0ce

Please sign in to comment.