From 130a43b61bd56995b8eb73fee77de667a874abf7 Mon Sep 17 00:00:00 2001 From: Shivam-nagar23 Date: Thu, 8 Jun 2023 16:54:56 +0530 Subject: [PATCH 1/2] enable api for all users --- pkg/module/ModuleService.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/module/ModuleService.go b/pkg/module/ModuleService.go index fbced4fa2a..fb0602aeeb 100644 --- a/pkg/module/ModuleService.go +++ b/pkg/module/ModuleService.go @@ -435,9 +435,6 @@ func (impl ModuleServiceImpl) HandleModuleAction(userId int32, moduleName string }, nil } func (impl ModuleServiceImpl) EnableModule(moduleName, version string) (*ActionResponse, error) { - if impl.serverEnvConfig.DevtronInstallationType != serverBean.DevtronInstallationTypeOssHelm { - return nil, errors.New("module Enabling is not allowed") - } // get module by name module, err := impl.moduleRepository.FindOne(moduleName) From cd9ee0f21c8393ba95dab00e5238609a589ef159 Mon Sep 17 00:00:00 2001 From: Shivam-nagar23 Date: Thu, 8 Jun 2023 17:59:54 +0530 Subject: [PATCH 2/2] fix for query break --- .../sql/repository/security/ImageScanResultRepository.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/sql/repository/security/ImageScanResultRepository.go b/internal/sql/repository/security/ImageScanResultRepository.go index 24cc26766c..a5b4b588e5 100644 --- a/internal/sql/repository/security/ImageScanResultRepository.go +++ b/internal/sql/repository/security/ImageScanResultRepository.go @@ -94,7 +94,7 @@ func (impl ImageScanResultRepositoryImpl) FetchByScanExecutionId(scanExecutionId Where("image_scan_execution_result.scan_execution_id = ?", id).Select() */ - err := impl.dbConnection.Model(&models).ColumnExpr("DISTINCT cve_store_name").Column("image_scan_execution_result.*", "CveStore"). + err := impl.dbConnection.Model(&models).Column("image_scan_execution_result.*", "CveStore"). Where("image_scan_execution_result.image_scan_execution_history_id = ?", scanExecutionId). Select() return models, err @@ -102,7 +102,7 @@ func (impl ImageScanResultRepositoryImpl) FetchByScanExecutionId(scanExecutionId func (impl ImageScanResultRepositoryImpl) FetchByScanExecutionIds(ids []int) ([]*ImageScanExecutionResult, error) { var models []*ImageScanExecutionResult - err := impl.dbConnection.Model(&models).ColumnExpr("DISTINCT cve_store_name").Column("image_scan_execution_result.*", "ImageScanExecutionHistory", "CveStore"). + err := impl.dbConnection.Model(&models).Column("image_scan_execution_result.*", "ImageScanExecutionHistory", "CveStore"). Where("image_scan_execution_result.image_scan_execution_history_id in(?)", pg.In(ids)). Select() return models, err @@ -110,14 +110,14 @@ func (impl ImageScanResultRepositoryImpl) FetchByScanExecutionIds(ids []int) ([] func (impl ImageScanResultRepositoryImpl) FindByImageDigest(imageDigest string) ([]*ImageScanExecutionResult, error) { var model []*ImageScanExecutionResult - err := impl.dbConnection.Model(&model).ColumnExpr("DISTINCT cve_store_name").Column("image_scan_execution_result.*", "ImageScanExecutionHistory", "CveStore"). + err := impl.dbConnection.Model(&model).Column("image_scan_execution_result.*", "ImageScanExecutionHistory", "CveStore"). Where("image_scan_execution_history.image_hash = ?", imageDigest).Order("image_scan_execution_history.execution_time desc").Select() return model, err } func (impl ImageScanResultRepositoryImpl) FindByImageDigests(digest []string) ([]*ImageScanExecutionResult, error) { var models []*ImageScanExecutionResult - err := impl.dbConnection.Model(&models).ColumnExpr("DISTINCT cve_store_name").Column("image_scan_execution_result.*", "ImageScanExecutionHistory", "CveStore"). + err := impl.dbConnection.Model(&models).Column("image_scan_execution_result.*", "ImageScanExecutionHistory", "CveStore"). Where("image_hash in (?)", pg.In(digest)).Order("execution_time desc").Select() return models, err }