cleanup: удалены закомментированные фрагменты кода (104 блока в 14 файлах)

This commit is contained in:
“Naeel”
2026-05-19 17:37:36 +04:00
parent e3a9593ba4
commit eb0f2f178b
14 changed files with 26 additions and 788 deletions
@@ -1,12 +1,8 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/instanceOperationCfsParams/{instanceOperationCfsParamUid}/subparams/{subparam}">
<cfsilent>
<cfimport prefix="m" taglib="../lib"/>
<cfset this.helper=CreateObject("component","lib.rest_api_helper")/><!---*** странно, почему мы его видим?---><!---вынести в апп?--->
</cfsilent>
<cffunction name="get" hint="Метаданные субпараметра CFS-параметра операции экземпляра (значение субпараметра находится в теле параметра)"><!--- *** спросить, может, метод не нужен, а если нужен - наверно, нужно значение --->
<cfargument name="instanceOperationCfsParamUid" type="string" required=true hint="type:guid"/>
<cfargument name="subparam" type="string" required=true hint="type:string"/>
@@ -16,9 +12,7 @@
<cfreturn representationOf(this.helper.formatBadRequestError(cfcatch)).withStatus(400)/>
</cfcatch>
</cftry>
<cfset local={}/>
<cfquery name="local.qRead" result="local.result">
select
<m:field_set titleMapOut="local.titleMap" lengthOut="fieldCount">
@@ -26,7 +20,6 @@
<m:field>ios.instance_operation_cfs_subparam</m:field>
<m:field formatter=#request.castToBool#>ios.is_sensitive</m:field>
<m:field>ios.note</m:field>
<!--- <m:field>iop.data_type</m:field> --->
<m:field>to_char(ios.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created</m:field>
</m:field_set>
from instance_operation_cfs_subparam ios
@@ -38,45 +31,31 @@
AND ios.instance_operation_cfs_subparam=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.subparam#"/>
AND si.specification_id=<cfqueryparam cfsqltype="cf_sql_integer" value=#arguments.specificationId#/> /*tenant isolation, из конфиденциального тут заметки... может быть, имена переменных окружения*/
</cfquery>
<cfif local.qRead.recordCount EQ 0>
<cfreturn representationOf(this.helper.formatMessage("Not Found")).withStatus(404)/>
</cfif>
<!--- <cfif local.qRead.data_type NEQ 'map'>
<cfreturn representationOf(this.helper.formatMessage("Parent parameter type does not have subparameters")).withStatus(400)/>
</cfif> --->
<cfset var out=structNew("linked")/>
<cfset "out.queryDurationMs"=getTickCount() - request.startTickCount/>
<cfset "out.instanceOperationCfsSubparam" = this.helper.appendRecord(
structNew("linked"), "", local.titleMap, local.qRead, this.helper.snake2camel
)/>
<cfset "out.runDurationMs"=getTickCount() - request.startTickCount/>
<cfreturn representationOf(out) />
</cffunction><!---/get --->
<cffunction name="delete" hint="Удаление метаданных субпараметра CFS-параметра операции экземпляра по ключу.">
<cfargument name="instanceOperationCfsParamUid" type="string" required=true hint="type:guid"/>
<cfargument name="subparam" type="string" required=true hint="type:string"/>
<cftry>
<cfset this.helper.validateField(arguments, "instanceOperationCfsParamUid", "guid")/>
<cfcatch type="invalidParamValue">
<cfreturn representationOf(this.helper.formatBadRequestError(cfcatch)).withStatus(400)/>
</cfcatch>
</cftry>
<cfset local={}/>
<cftry>
<!--- проверка существования одновременно может служить для изоляции тенантов --->
<!--- без проверки стартовавшей операции --->
<!--- нужна проверка на изоляцию тенантов --->
<cfquery name="local.qCheckExistence" result="local.result">
select count(*) as cnt
from instance_operation_cfs_subparam ios
@@ -86,7 +65,6 @@
<cfif local.qCheckExistence.cnt EQ 0>
<cfreturn representationOf(this.helper.formatMessage("Not Found", "Subparameter specified does not exist")).withStatus(404)/>
</cfif>
<cfquery name="local.qCheckAccess" result="local.result">
select count(*) as cnt
from instance_operation_cfs_param iop
@@ -99,40 +77,31 @@
<cfif local.qCheckAccess.cnt EQ 0>
<cfreturn representationOf(this.helper.formatMessage("Not Accessible", "CFS parameter specified is not accessible by the current user")).withStatus(403)/>
</cfif>
<cfquery name="local.qSave">
delete from instance_operation_cfs_subparam
where instance_operation_cfs_param_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationCfsParamUid#" null=#!isValid('guid',arguments.instanceOperationCfsParamUid)#/>
AND instance_operation_cfs_subparam=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.subparam#"/>
</cfquery>
<cfcatch type="any">
<cfreturn representationOf(this.helper.formatException(cfcatch, "Internal Error")).withStatus(500)/><!--- *** это не нужно показывать в продуктиве --->
</cfcatch>
</cftry>
<cfreturn noData().withStatus(204, "No Content") />
</cffunction><!--- delete --->
<cffunction name="put" hint="запись метаданных субпараметра CFS-параметра операции инстанса">
<cfargument name="instanceOperationCfsParamUid" type="string" required=true hint="type:guid"/>
<cfargument name="subparam" type="string" required=true hint="type:string"/>
<cfargument name="isSensitive" type="boolean" required=false default=false hint="type:boolean"/>
<cfargument name="note" type="string" required=false default=""/> <!--- *** XSS!!! --->
<cftry>
<cfset this.helper.validateField(arguments, "instanceOperationCfsParamUid", "guid")/>
<cfset this.helper.validateField(arguments, "isSensitive", "boolean")/>
<!--- *** Нужна проверка, что операция не была выполнена, иначе она становится архивной --->
<cfcatch type="invalidParamValue">
<cfreturn representationOf(this.helper.formatBadRequestError(cfcatch)).withStatus(400)/>
</cfcatch>
</cftry>
<cfset var local={}/>
<cfquery name="local.qCheckAccess" result="local.result">
select count(*) as cnt
from instance_operation_cfs_param iop
@@ -145,7 +114,6 @@
<cfif local.qCheckAccess.cnt EQ 0>
<cfreturn representationOf(this.helper.formatMessage("Not Accessible", "Instance CFS parameter not found or access denied")).withStatus(404)/>
</cfif>
<cfquery name="local.qCheckExistence" result="local.result">
select count(*) as cnt
from instance_operation_cfs_subparam iop
@@ -155,7 +123,6 @@
<cfif local.qCheckExistence.cnt EQ 0>
<cfreturn representationOf(this.helper.formatMessage("Not Found", "Subparameter specified does not exist")).withStatus(404)/>
</cfif>
<cfquery name="local.qSave" result="local.result">
update instance_operation_cfs_subparam set
dt_updated=<cfqueryparam cfsqltype="cf_sql_timestamp" value="#Now()#" />
@@ -168,5 +135,4 @@
<!--- *** проверить существование - 404 --->
<cfreturn noData().withStatus(204, "No Content") />
</cffunction><!--- put --->
</cfcomponent>
</cfcomponent>