Skip to content

Commit

Permalink
fix: enable api for all users for module (#3495)
Browse files Browse the repository at this point in the history
* enable api for all users

* fix for query break
  • Loading branch information
Shivam-nagar23 authored Jun 8, 2023
1 parent 0e1ea87 commit 470dc3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 4 additions & 4 deletions internal/sql/repository/security/ImageScanResultRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,30 @@ 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
}

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
}

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
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/module/ModuleService.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 470dc3c

Please sign in to comment.