Skip to content

Commit

Permalink
🐛 Fix analyses RBAC.
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <jortel@redhat.com>
  • Loading branch information
jortel committed Aug 10, 2023
1 parent f9552d7 commit 9ad8637
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
10 changes: 6 additions & 4 deletions api/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,24 @@ type AnalysisHandler struct {
// AddRoutes adds routes.
func (h AnalysisHandler) AddRoutes(e *gin.Engine) {
routeGroup := e.Group("/")
routeGroup.Use(Required("application"))
//
routeGroup.Use(Required("analyses"))
// Analyses
routeGroup.GET(AnalysisRoot, h.Get)
routeGroup.DELETE(AnalysisRoot, h.Delete)
routeGroup.GET(AnalysesDepsRoot, h.Deps)
routeGroup.GET(AnalysesIssuesRoot, h.Issues)
routeGroup.GET(AnalysesIssueRoot, h.Issue)
routeGroup.GET(AnalysisIncidentsRoot, h.Incidents)
//
// Reports
routeGroup.GET(AnalysisReportRuleRoot, h.RuleReports)
routeGroup.GET(AnalysisReportAppsIssuesRoot, h.AppIssueReports)
routeGroup.GET(AnalysisReportIssuesAppsRoot, h.IssueAppReports)
routeGroup.GET(AnalysisReportFileRoot, h.FileReports)
routeGroup.GET(AnalysisReportDepsRoot, h.DepReports)
routeGroup.GET(AnalysisReportDepsAppsRoot, h.DepAppReports)
//
// Application
routeGroup = e.Group("/")
routeGroup.Use(Required("applications.analyses"))
routeGroup.POST(AppAnalysesRoot, h.AppCreate)
routeGroup.GET(AppAnalysesRoot, h.AppList)
routeGroup.GET(AppAnalysisRoot, h.AppLatest)
Expand Down
1 change: 1 addition & 0 deletions auth/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var AddonRole = []string{
"applications.tags:*",
"applications.facts:*",
"applications.bucket:*",
"applications.analyses:*",
"identities:get",
"identities:decrypt",
"proxies:get",
Expand Down
38 changes: 37 additions & 1 deletion auth/roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
- get
- post
- put
- name: applications.analyses
verbs:
- delete
- get
- post
- put
- name: applications.stakeholders
verbs:
- put
Expand Down Expand Up @@ -173,6 +179,12 @@
- get
- post
- put
- name: analyses
verbs:
- delete
- get
- post
- put
- role: tackle-architect
resources:
- name: addons
Expand Down Expand Up @@ -208,6 +220,12 @@
- get
- post
- put
- name: applications.analyses
verbs:
- delete
- get
- post
- put
- name: applications.stakeholders
verbs:
- put
Expand Down Expand Up @@ -335,6 +353,12 @@
- get
- post
- put
- name: analyses
verbs:
- delete
- get
- post
- put
- role: tackle-migrator
resources:
- name: addons
Expand All @@ -355,6 +379,9 @@
- name: applications.bucket
verbs:
- get
- name: applications.analyses
verbs:
- get
- name: assessments
verbs:
- get
Expand Down Expand Up @@ -436,6 +463,9 @@
- name: targets
verb:
- get
- name: analyses
verbs:
- get
- role: tackle-project-manager
resources:
- name: addons
Expand All @@ -456,6 +486,9 @@
- name: applications.bucket
verbs:
- get
- name: applications.analyses
verbs:
- get
- name: applications.stakeholders
verbs:
- put
Expand Down Expand Up @@ -530,4 +563,7 @@
- put
- name: targets
verbs:
- get
- get
- name: analyses
verbs:
- get

0 comments on commit 9ad8637

Please sign in to comment.