Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions sqle/api/controller/v1/audit_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ func GetAuditPlans(c echo.Context) error {
"offset": offset,
}
if !up.CanViewProject() {
instanceNames, err := dms.GetInstanceNamesInProjectByIds(c.Request().Context(), projectUid, up.GetInstancesByOP(v1.OpPermissionTypeViewOtherAuditPlan))
instanceNames, err := dms.GetInstanceNamesInProjectByIds(c.Request().Context(), projectUid, up.GetInstancesByOP(v1.OpPermissionTypeSaveAuditPlan))
if err != nil {
return err
}
Expand Down Expand Up @@ -797,7 +797,7 @@ func GetAuditPlanReports(c echo.Context) error {
}
apName := c.Param("audit_plan_name")

_, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
_, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeSaveAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
Expand Down Expand Up @@ -857,7 +857,7 @@ func GetAuditPlanReport(c echo.Context) error {
}
apName := c.Param("audit_plan_name")

ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeSaveAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
Expand Down Expand Up @@ -1225,7 +1225,7 @@ func GetAuditPlanNotifyConfig(c echo.Context) error {
}
apName := c.Param("audit_plan_name")

ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeSaveAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
Expand Down Expand Up @@ -1401,7 +1401,7 @@ func GetAuditPlanSQLs(c echo.Context) error {
}
apName := c.Param("audit_plan_name")

ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeSaveAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
Expand Down Expand Up @@ -1482,7 +1482,7 @@ func GetAuditPlanReportSQLsV1(c echo.Context) error {
}
apName := c.Param("audit_plan_name")

ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, v1.OpPermissionTypeSaveAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
Expand Down
6 changes: 3 additions & 3 deletions sqle/api/controller/v1/project_permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func GetInstanceAuditPlanIfCurrentUserCanView(c echo.Context, projectId, instanc
return ap, true, nil
}
}
opTypes := []dmsV1.OpPermissionType{dmsV1.OpPermissionTypeViewOtherAuditPlan, dmsV1.OpPermissionTypeSaveAuditPlan}
opTypes := []dmsV1.OpPermissionType{dmsV1.OpPermissionTypeSaveAuditPlan}
for _, opType := range opTypes {
dbServiceReq := &dmsV2.ListDBServiceReq{
ProjectUid: projectId,
Expand All @@ -344,7 +344,7 @@ func GetInstanceAuditPlanIfCurrentUserCanView(c echo.Context, projectId, instanc
}
}
}
return ap, false, errors.NewUserNotPermissionError(dmsV1.GetOperationTypeDesc(dmsV1.OpPermissionTypeViewOtherAuditPlan))
return ap, false, errors.NewUserNotPermissionError(dmsV1.GetOperationTypeDesc(dmsV1.OpPermissionTypeSaveAuditPlan))
}

func GetInstanceAuditPlanIfCurrentUserCanOp(c echo.Context, projectId, instanceAuditPlanID string, opType dmsV1.OpPermissionType) (*model.InstanceAuditPlan, bool, error) {
Expand Down Expand Up @@ -399,7 +399,7 @@ func GetAuditPlantReportAndInstanceIfCurrentUserCanView(c echo.Context, projectI
auditPlanReport *model.AuditPlanReportV2, auditPlanReportSQLV2 *model.AuditPlanReportSQLV2, instance *model.Instance,
err error) {

ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectId, auditPlanName, dmsV1.OpPermissionTypeViewOtherAuditPlan)
ap, exist, err := GetAuditPlanIfCurrentUserCanView(c, projectId, auditPlanName, dmsV1.OpPermissionTypeSaveAuditPlan)
if err != nil {
return nil, nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions sqle/api/controller/v2/audit_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func GetAuditPlans(c echo.Context) error {
"offset": offset,
}
if !up.IsAdmin() {
instanceNames, err := dms.GetInstanceNamesInProjectByIds(c.Request().Context(), projectUid, up.GetInstancesByOP(dmsV1.OpPermissionTypeViewOtherAuditPlan))
instanceNames, err := dms.GetInstanceNamesInProjectByIds(c.Request().Context(), projectUid, up.GetInstancesByOP(dmsV1.OpPermissionTypeSaveAuditPlan))
if err != nil {
return err
}
Expand Down Expand Up @@ -195,7 +195,7 @@ func GetAuditPlanReportSQLs(c echo.Context) error {
}
apName := c.Param("audit_plan_name")

ap, exist, err := v1.GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, dmsV1.OpPermissionTypeViewOtherAuditPlan)
ap, exist, err := v1.GetAuditPlanIfCurrentUserCanView(c, projectUid, apName, dmsV1.OpPermissionTypeSaveAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
Expand Down
2 changes: 1 addition & 1 deletion sqle/api/controller/v2/instance_audit_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func GetInstanceAuditPlans(c echo.Context) error {
}
if !up.CanViewProject() {
// 如果有配置SQL管控权限,那么可以查看自己创建的或者该权限对应数据源的
accessibleInstanceId := up.GetInstancesByOP(dmsCommonV1.OpPermissionTypeViewOtherAuditPlan, dmsCommonV1.OpPermissionTypeSaveAuditPlan)
accessibleInstanceId := up.GetInstancesByOP(dmsCommonV1.OpPermissionTypeSaveAuditPlan)
if len(accessibleInstanceId) > 0 {
data["accessible_instances_id"] = fmt.Sprintf("\"%s\"", strings.Join(accessibleInstanceId, "\",\""))
}
Expand Down
Loading