MigrationAssistant: Restrict dashboards, folders and datasources by the org id of the signed in user (#96339)
apply security patch: main/206-202410241510.patch
This commit is contained in:
@@ -175,7 +175,7 @@ func (cma *CloudMigrationAPI) GetSessionList(c *contextmodel.ReqContext) respons
|
||||
ctx, span := cma.tracer.Start(c.Req.Context(), "MigrationAPI.GetSessionList")
|
||||
defer span.End()
|
||||
|
||||
sl, err := cma.cloudMigrationService.GetSessionList(ctx)
|
||||
sl, err := cma.cloudMigrationService.GetSessionList(ctx, c.OrgID)
|
||||
if err != nil {
|
||||
span.SetStatus(codes.Error, "session list error")
|
||||
span.RecordError(err)
|
||||
@@ -208,7 +208,7 @@ func (cma *CloudMigrationAPI) GetSession(c *contextmodel.ReqContext) response.Re
|
||||
return response.Error(http.StatusBadRequest, "invalid session uid", err)
|
||||
}
|
||||
|
||||
s, err := cma.cloudMigrationService.GetSession(ctx, uid)
|
||||
s, err := cma.cloudMigrationService.GetSession(ctx, c.OrgID, uid)
|
||||
if err != nil {
|
||||
span.SetStatus(codes.Error, "session not found")
|
||||
span.RecordError(err)
|
||||
@@ -247,6 +247,7 @@ func (cma *CloudMigrationAPI) CreateSession(c *contextmodel.ReqContext) response
|
||||
}
|
||||
s, err := cma.cloudMigrationService.CreateSession(ctx, cloudmigration.CloudMigrationSessionRequest{
|
||||
AuthToken: cmd.AuthToken,
|
||||
OrgID: c.SignedInUser.OrgID,
|
||||
})
|
||||
if err != nil {
|
||||
span.SetStatus(codes.Error, "session creation error")
|
||||
@@ -285,7 +286,7 @@ func (cma *CloudMigrationAPI) DeleteSession(c *contextmodel.ReqContext) response
|
||||
return response.ErrOrFallback(http.StatusBadRequest, "invalid session uid", err)
|
||||
}
|
||||
|
||||
_, err := cma.cloudMigrationService.DeleteSession(ctx, uid)
|
||||
_, err := cma.cloudMigrationService.DeleteSession(ctx, c.OrgID, uid)
|
||||
if err != nil {
|
||||
span.SetStatus(codes.Error, "session delete error")
|
||||
span.RecordError(err)
|
||||
@@ -365,6 +366,7 @@ func (cma *CloudMigrationAPI) GetSnapshot(c *contextmodel.ReqContext) response.R
|
||||
SessionUID: sessUid,
|
||||
ResultPage: c.QueryInt("resultPage"),
|
||||
ResultLimit: c.QueryInt("resultLimit"),
|
||||
OrgID: c.SignedInUser.OrgID,
|
||||
}
|
||||
if q.ResultLimit == 0 {
|
||||
q.ResultLimit = 100
|
||||
@@ -448,6 +450,7 @@ func (cma *CloudMigrationAPI) GetSnapshotList(c *contextmodel.ReqContext) respon
|
||||
Limit: c.QueryInt("limit"),
|
||||
Page: c.QueryInt("page"),
|
||||
Sort: c.Query("sort"),
|
||||
OrgID: c.SignedInUser.OrgID,
|
||||
}
|
||||
if q.Limit == 0 {
|
||||
q.Limit = 100
|
||||
@@ -508,7 +511,7 @@ func (cma *CloudMigrationAPI) UploadSnapshot(c *contextmodel.ReqContext) respons
|
||||
return response.ErrOrFallback(http.StatusBadRequest, "invalid snapshot uid", err)
|
||||
}
|
||||
|
||||
if err := cma.cloudMigrationService.UploadSnapshot(ctx, sessUid, snapshotUid); err != nil {
|
||||
if err := cma.cloudMigrationService.UploadSnapshot(ctx, c.OrgID, sessUid, snapshotUid); err != nil {
|
||||
span.SetStatus(codes.Error, "error uploading snapshot")
|
||||
span.RecordError(err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user