File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,13 @@ func RunsForProject(c *gin.Context) {
50
50
return
51
51
}
52
52
53
+ if project .OrganisationID != org .ID {
54
+ log .Printf ("Forbidden access: not allowed to access projectID: %v logged in org: %v" , project .OrganisationID , org .ID )
55
+ c .String (http .StatusForbidden , "No access to this project" )
56
+ return
57
+
58
+ }
59
+
53
60
runs , err := models .DB .ListDiggerRunsForProject (project .Name , project .Repo .ID )
54
61
if err != nil {
55
62
log .Printf ("could not fetch runs: %v" , err )
@@ -67,5 +74,15 @@ func RunsForProject(c *gin.Context) {
67
74
}
68
75
serializedRuns = append (serializedRuns , serializedRun )
69
76
}
70
- c .JSON (http .StatusOK , serializedRuns )
77
+ response := make (map [string ]interface {})
78
+ response ["runs" ] = serializedRuns
79
+ c .JSON (http .StatusOK , response )
80
+ }
81
+
82
+ func RunDetails (c * gin.Context ) {
83
+ //currentOrg, exists := c.Get(middleware.ORGANISATION_ID_KEY)
84
+ //projectIdStr := c.Param("project_id")
85
+
86
+ response := make (map [string ]interface {})
87
+ c .JSON (http .StatusOK , response )
71
88
}
Original file line number Diff line number Diff line change @@ -167,6 +167,10 @@ func main() {
167
167
projectsApiGroup .GET ("/" , controllers .FindProjectsForOrg )
168
168
projectsApiGroup .GET ("/:project_id/runs" , controllers .RunsForProject )
169
169
170
+ runsApiGroup := apiGroup .Group ("/runs" )
171
+ runsApiGroup .Use (middleware .GetWebMiddleware ())
172
+ projectsApiGroup .GET ("/:project_id/runs/:id" , controllers .RunDetails )
173
+
170
174
fronteggWebhookProcessor .POST ("/create-org-from-frontegg" , controllers .CreateFronteggOrgFromWebhook )
171
175
172
176
r .Run (fmt .Sprintf (":%d" , cfg .GetInt ("port" )))
You can’t perform that action at this time.
0 commit comments