090 intermediate
This commit is contained in:
+1
-5
@@ -51,7 +51,7 @@
|
||||
|
||||
//variables.framework.docs={};
|
||||
variables.framework.docs.APIName="Deck API";
|
||||
variables.framework.docs.APIVersion="0.089";
|
||||
variables.framework.docs.APIVersion="0.090";
|
||||
|
||||
variables.framework.globalHeaders = structNew();
|
||||
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
||||
@@ -74,10 +74,6 @@
|
||||
//request.IAM_SERVICE_URL=this.iamServiceUrl;
|
||||
</cfscript>
|
||||
|
||||
<!--- <cfset this.orchestrator_authorization_string=createObject("java", "java.lang.System").getEnv("ORCHESTRATOR_AUTH")/>
|
||||
<cfif isEmpty(this.orchestrator_authorization_string)>
|
||||
<cfset this.orchestrator_authorization_string = "Basic c3ZjX2xrdGVzdDoxMTgzZDIyNzc1OWExYjFkZmVjM2M3NTFiMzIyNzdiYTQ3"/><!--- *** remove --->
|
||||
</cfif> --->
|
||||
|
||||
<cffunction name="rethrow" returntype="void">
|
||||
<!--- https://www.raymondcamden.com/2004/03/09/3089633C-9FA0-606B-3F540AE9642A795F --->
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
<cffunction name="get" hint="Операция над экземпляром сервиса"><!--- *** TODO проверка принадлежности тенанту --->
|
||||
<cfargument name="instanceOperationUid" type="string" required=true hint="type:guid"/>
|
||||
<!--- arguments.specificationId injected implicitly --->
|
||||
|
||||
<cftry>
|
||||
<cfset this.helper.validateField(arguments, "instanceOperationUid", "guid")/>
|
||||
<cfcatch type="invalidParamValue">
|
||||
@@ -22,8 +24,8 @@
|
||||
<m:field_set titleMapOut="local.titleMap" lengthOut="local.fieldCount">
|
||||
<m:field>o.instance_operation_uid::text as instance_operation_uid</m:field>
|
||||
<m:field>o.operation</m:field>
|
||||
<m:field>o.resource_realm_id</m:field>
|
||||
<m:field>r.resource_realm</m:field>
|
||||
<!--- <m:field>o.resource_realm_id</m:field>
|
||||
<m:field>r.resource_realm</m:field> --->
|
||||
<m:field>o.instance_uid::text as instance_uid</m:field>
|
||||
<m:field>to_char(o.dt_submit, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_submit</m:field>
|
||||
<m:field>o.submit_result</m:field>
|
||||
@@ -51,13 +53,15 @@
|
||||
join contragent k on (d.contragent_id=k.contragent_id)
|
||||
join svc v on (e.service_id=v.svc_id)
|
||||
join svc_operation so on (v.svc_id=so.svc_id AND o.operation=so.operation)
|
||||
left outer join resource_realm r on (o.resource_realm_id=r.resource_realm_id)
|
||||
<!--- left outer join resource_realm r on (o.resource_realm_id=r.resource_realm_id) --->
|
||||
left outer join usr u on (o.updater_id=u.usr_id)
|
||||
where <!--- u.usr_id=<cfqueryparam cfsqltype="cf_sql_integer" value=#arguments.usrId#/> AND--->
|
||||
o.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid('guid',arguments.instanceOperationUid)#/>
|
||||
AND s.specification_id=<cfqueryparam cfsqltype="cf_sql_integer" value=#arguments.specificationId#/>
|
||||
</cfquery>
|
||||
|
||||
<!--- <cfdump var=#local.qInstanceOperation#/><cfabort/> --->
|
||||
|
||||
<cfif local.qInstanceOperation.recordCount EQ 0>
|
||||
<cfreturn representationOf(this.helper.formatMessage("Not Found")).withStatus(404)/>
|
||||
</cfif>
|
||||
@@ -72,7 +76,6 @@
|
||||
<m:field>to_char(ios.dt_start, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_start</m:field>
|
||||
<m:field>to_char(ios.dt_finish, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_finish</m:field>
|
||||
<m:field>round(extract('epoch' from coalesce(ios.dt_finish,CURRENT_TIMESTAMP)- ios.dt_start),1) as duration</m:field>
|
||||
<!--- <m:field formatter=#function(x){return (deserializeJson(x))}#>ios.stage_data::text as stage_data</m:field> --->
|
||||
</m:field_set>
|
||||
from instance_operation_stage ios
|
||||
where ios.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#local.qInstanceOperation.instance_operation_uid#" null=#!isValid('guid',local.qInstanceOperation.instance_operation_uid)#/>
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
<cfset this.helper.validateField(arguments, "svcOperationCfsParamId", "integer")/>
|
||||
<!--- Еще возможна ошибка, что мы подадим параметр не от своей операции или сервиса - он останется невидим для всех --->
|
||||
<cfset checkParam(arguments.svcOperationCfsParamId, arguments.paramValue)/>
|
||||
<cfset checkResourceRealmAccess(arguments.instanceOperationUid, arguments.svcOperationCfsParamId, arguments.paramValue)/>
|
||||
|
||||
<cfcatch type="invalidParamValue">
|
||||
<cfreturn representationOf(this.helper.formatBadRequestError(cfcatch)).withStatus(400)/>
|
||||
@@ -212,31 +213,24 @@
|
||||
</cfquery>
|
||||
|
||||
<cfif qSvcOperationCfsParam.is_required GT 0 AND len(arguments.paramValue) EQ 0>
|
||||
<!--- <cfreturn "Missing required parameter (#qSvcOperationCfsParam.svc_operation_cfs_param#)"/> --->
|
||||
<cfthrow type="invalidParamValue" message="Missing required parameter (#qSvcOperationCfsParam.svc_operation_cfs_param#)"/>
|
||||
<cfelseif len(arguments.paramValue) AND NOT validateDataType(arguments.paramValue,qSvcOperationCfsParam.data_type)>
|
||||
<!--- <cfreturn "Invalid format (#qSvcOperationCfsParam.svc_operation_cfs_param#)"/> --->
|
||||
<cfthrow type="invalidParamValue" message="Invalid format (#qSvcOperationCfsParam.svc_operation_cfs_param#)"/>
|
||||
</cfif>
|
||||
|
||||
<cfif len(arguments.paramValue) AND listLen(qSvcOperationCfsParam.value_list) GT 0 AND NOT listFind(qSvcOperationCfsParam.value_list, arguments.paramValue)>
|
||||
<!--- <cfreturn "Значение параметра #qSvcOperationCfsParam.svc_operation_cfs_param# отсутствует в списке #qSvcOperationCfsParam.value_list#"/> --->
|
||||
<cfthrow type="invalidParamValue" message="Значение параметра #qSvcOperationCfsParam.svc_operation_cfs_param# отсутствует в списке #qSvcOperationCfsParam.value_list#"/>
|
||||
</cfif>
|
||||
<cfif len(arguments.paramValue) AND qSvcOperationCfsParam.maxlength GT 0 AND len(arguments.paramValue) GT qSvcOperationCfsParam.maxlength>
|
||||
<!--- <cfreturn "Длина #qSvcOperationCfsParam.svc_operation_cfs_param# превышает #qSvcOperationCfsParam.maxlength#"/> --->
|
||||
<cfthrow type="invalidParamValue" message="Длина #qSvcOperationCfsParam.svc_operation_cfs_param# превышает #qSvcOperationCfsParam.maxlength#"/>
|
||||
</cfif>
|
||||
<cfif len(arguments.paramValue) AND qSvcOperationCfsParam.minlength GT 0 AND len(arguments.paramValue) LT qSvcOperationCfsParam.minlength>
|
||||
<!--- <cfreturn "Длина #qSvcOperationCfsParam.svc_operation_cfs_param# меньше #qSvcOperationCfsParam.minlength#"/> ---> <!--- *** попробовать cfparam type="regex" --->
|
||||
<cfthrow type="invalidParamValue" message="Длина #qSvcOperationCfsParam.svc_operation_cfs_param# меньше #qSvcOperationCfsParam.minlength#"/>
|
||||
</cfif>
|
||||
<cfif len(arguments.paramValue) AND len(qSvcOperationCfsParam.regex) AND reFind(qSvcOperationCfsParam.regex,arguments.paramValue) EQ 0>
|
||||
<!--- <cfreturn 'Pattern "#qSvcOperationCfsParam.regex#" does not match "#arguments.paramValue#"'/> --->
|
||||
<cfthrow type="invalidParamValue" message='Parameter "#qSvcOperationCfsParam.svc_operation_cfs_param#" value "#arguments.paramValue#" does not match pattern "#qSvcOperationCfsParam.regex#" '/>
|
||||
</cfif>
|
||||
<cfif isNumeric(arguments.paramValue) AND isNumeric(qSvcOperationCfsParam.maxvalue) AND arguments.paramValue GT qSvcOperationCfsParam.maxvalue>
|
||||
<!--- <cfreturn 'Pattern "#qSvcOperationCfsParam.regex#" does not match "#arguments.paramValue#"'/> --->
|
||||
<cfthrow type="invalidParamValue" message='Parameter "#qSvcOperationCfsParam.svc_operation_cfs_param#" value "#arguments.paramValue#" is greater than "#qSvcOperationCfsParam.maxvalue#" '/>
|
||||
</cfif>
|
||||
<cfif isNumeric(arguments.paramValue) AND isNumeric(qSvcOperationCfsParam.minvalue) AND arguments.paramValue LT qSvcOperationCfsParam.minvalue>
|
||||
@@ -247,9 +241,10 @@
|
||||
|
||||
<!--- ****** Внимание! Этот код сравнивает параметры одноименных операций, но уникальность должна быть и между create-modify и т.п. --->
|
||||
|
||||
|
||||
<cfset checkUniqueness(
|
||||
qSvcOperationCfsParam.svc_operation_cfs_param_id, <!--- *** есть в аргументах, но было так - пока не меняю --->
|
||||
arguments.svcOperationCfsParamId,
|
||||
qSvcOperationCfsParam.svc_operation_cfs_param,
|
||||
arguments.paramValue,
|
||||
qSvcOperationCfsParam.unique_scope,
|
||||
arguments.instanceOperationCfsParamUid
|
||||
@@ -313,12 +308,12 @@
|
||||
</cfif>
|
||||
</cfcase>
|
||||
|
||||
<cfdefaultcase></cfdefaultcase>
|
||||
|
||||
<cfdefaultcase></cfdefaultcase>
|
||||
</cfswitch>
|
||||
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="validateDataType" returnType="boolean">
|
||||
<cfargument name="value" type="string"/>
|
||||
<cfargument name="dataType" type="string"/>
|
||||
@@ -356,4 +351,48 @@
|
||||
<!--- --->
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="checkResourceRealmAccess" returnType="void">
|
||||
<!---*** В отличие от других методов, этому небезразлично имя параметра --->
|
||||
<cfargument name="instanceOperationUid" type="giud"/>
|
||||
<cfargument name="svcOperationCfsParamId" type="numeric"/>
|
||||
<cfargument name="paramValue" type="string"/>
|
||||
|
||||
<cfset var local={}/>
|
||||
|
||||
<cfquery name="local.qSvcOperationCfsParam">
|
||||
select sop.svc_operation_cfs_param_id
|
||||
,sop.svc_operation_cfs_param
|
||||
from svc_operation_cfs_param sop
|
||||
where sop.svc_operation_cfs_param_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.svcOperationCfsParamId#"/>
|
||||
</cfquery>
|
||||
<cfif lcase(trim(local.qSvcOperationCfsParam.svc_operation_cfs_param)) NEQ lcase("resourceRealm")>
|
||||
<cfreturn/>
|
||||
</cfif>
|
||||
|
||||
<cfquery name="local.qContract">
|
||||
select c.contract_id
|
||||
from instance_operation io
|
||||
join instance e on (io.instance_uid=e.instance_uid)
|
||||
join specification_item si on (e.specification_item_id=si.specification_item_id)
|
||||
join specification s on (si.specification_id=s.specification_id)
|
||||
join contract c on (s.contract_id=c.contract_id)
|
||||
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid("guid",arguments.instanceOperationUid)#/>
|
||||
</cfquery>
|
||||
|
||||
<cfquery name="local.qCheckResourceRealmAccess">
|
||||
select r.resource_realm_id, r.resource_realm, iop.param, iop.param_value, a.contract_id, a.is_enabled
|
||||
from resource_realm r
|
||||
join resource_realm_access a on (r.resource_realm_id=a.resource_realm_id)
|
||||
where r.resource_realm = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.paramValue#"/>
|
||||
AND (a.contract_id=<cfqueryparam cfsqltype="cf_sql_integer" value=#local.qContract.contract_id# null=#!isValid("integer",local.qContract.contract_id)#/> OR a.contract_id=0)
|
||||
AND a.is_enabled
|
||||
</cfquery>
|
||||
|
||||
<cfif local.qCheckResourceRealmAccess.recordCount EQ 0>
|
||||
<cfthrow message="Resource realm specified in CFS param is not available for the current contract" detail="CFS resource realm #arguments.paramValue# unawailable. Instance operation UID #arguments.instanceOperationUid#. Contract ID #arguments.contractId#"/>
|
||||
</cfif>
|
||||
|
||||
</cffunction>
|
||||
|
||||
|
||||
</cfcomponent>
|
||||
@@ -11,7 +11,7 @@
|
||||
<cffunction name="post" hint="Создание новой операции. Отдельно загружаются CFS параметры, генерируются RFS параметры. Запускается операция отдельным вызовом. До запуска CFS параметры могут корректироваться (а надо?). Запущенная операция вместе с параметрами навсегда становится Read Only (при желании можем реализовать ее клонирование). Можем реализовать корректировку параметров, но непонятно, зачем. Когда мы конфигурируем инстанс, на самом деле мы задаем CFS параметры операции create. Можно править параметры, а можно пересоздать операцию с новыми параметрами. Предусмотреть удаление (метод DELETE) незапущенной операции?">
|
||||
<cfargument name="instanceUid" type="string" required=true hint="type:guid"/>
|
||||
<cfargument name="operation" type="string" required=true hint="type:string decsiption: operation name, e.g. create"/>
|
||||
<cfargument name="resourceRealmId" type="string" default=-1 hint="type:integer decsiption: идентификатор ресурсной платформы"/><!--- *** --->
|
||||
<!--- <cfargument name="resourceRealmId" type="string" default=-1 hint="type:integer decsiption: идентификатор ресурсной платформы"/> ---><!--- *** --->
|
||||
<!--- *** полноценная валидация операции предполагает проверку, что операция поддерживается для данного сервиса и текущего состояния инстанса. Можно представить себе зависимость этого от параметров, но хотелось бы избежать такого усложнения --->
|
||||
<!--- Можно отметить, что, например, допустимость операции delete зависит от контекста - сколько времени сервис остановлен --->
|
||||
<cftry>
|
||||
@@ -31,9 +31,9 @@
|
||||
<!--- *** Добавить проверку разрешенных переходов, например, create нельзя сделать на развернутом экземпляре
|
||||
*** Вероятно, допустимые переходы нужно либо специфицировать в документации, либо явно опубликовать (инстанс может публиковать список допустимых операций) --->
|
||||
|
||||
<cfif listFind("create,redeploy",arguments.operation)>
|
||||
<!--- <cfif listFind("create,redeploy",arguments.operation)>
|
||||
<cfset checkResourceRealmId(arguments.resourceRealmId, arguments.instanceUid)/>
|
||||
</cfif>
|
||||
</cfif> --->
|
||||
|
||||
<cfcatch type="invalidParamValue">
|
||||
<cfreturn representationOf(this.helper.formatBadRequestError(cfcatch)).withStatus(400)/>
|
||||
@@ -46,7 +46,7 @@
|
||||
<cftry>
|
||||
<cfquery name="local.qSave">
|
||||
insert into instance_operation
|
||||
(instance_uid, instance_operation_uid, operation, dt_created, creator_id, dt_updated, updater_id, resource_realm_id)
|
||||
(instance_uid, instance_operation_uid, operation, dt_created, creator_id, dt_updated, updater_id)
|
||||
values
|
||||
(
|
||||
<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceUid#" />
|
||||
@@ -56,7 +56,6 @@
|
||||
,<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.usrId#" />
|
||||
,<cfqueryparam cfsqltype="cf_sql_timestamp" value="#Now()#" />
|
||||
,<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.usrId#" />
|
||||
,<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.resourceRealmId#"/>
|
||||
);
|
||||
</cfquery>
|
||||
|
||||
@@ -71,7 +70,7 @@
|
||||
/>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="checkResourceRealmId" returntype="void">
|
||||
<cffunction name="checkResourceRealmId" returntype="void" hint="deprecated">
|
||||
<!--- В данном случае мы проверяем соответствие платформы сервису, а не операции, поэтому вопрос, нужен ли для данной операции параметр resourceRealm, надо решать вне этой функции --->
|
||||
<cfargument name="resourceRealmId" type="numeric" required=true/>
|
||||
<cfargument name="instanceUid" type="guid" required=true/>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<cfset local.cfsParamChecker = CreateObject("component", "instance_operation_cfs_param_ls")/>
|
||||
|
||||
<!--- we could check existence of required parameters right in the query,
|
||||
but for possible value chech and verbosity do it in the loop --->
|
||||
but for possible value check and verbosity do it in the loop --->
|
||||
<cfloop query=#local.qCheckCfsParams#>
|
||||
<cfif (local.qCheckCfsParams.is_required GT 0 AND NOT len(local.qCheckCfsParams.instance_operation_cfs_param_uid) GT 0)><!--- check CFS param existence --->
|
||||
<cfreturn representationOf(this.helper.formatMessage("required CFS parameter #local.qCheckCfsParams.svc_operation_cfs_param# (#local.qCheckCfsParams.svc_operation_cfs_param_id#) is missing", "Missing required CFS parameter")).withStatus(409)/>
|
||||
@@ -78,6 +78,8 @@
|
||||
|
||||
<!--- ***** тут должен быть контроль доступа на уровне параметров. Желательно по максимуму параноидальный --->
|
||||
<!--- ***** или при сабмите. Может быть, и на уровне RFS параметров тоже --->
|
||||
<cfset checkCfsResourceRealmAccess(arguments.instanceOperationUid)/>
|
||||
|
||||
<cfset generateRfsParams(arguments.instanceOperationUid, arguments.usrId, arguments.contragentId, arguments.contractId)/><!--- *** кроме usr_id остальные параметры избыточны - информация есть у инстанса --->
|
||||
|
||||
<cfset checkRfsResourceRealmAccess(arguments.instanceOperationUid)/>
|
||||
@@ -127,10 +129,10 @@
|
||||
<cfset setInstanceOperationRfsParam(arguments.instanceOperationUid, "contragentCode", getContragentCode(arguments.contragentId))/>
|
||||
</cfif>
|
||||
|
||||
<cfif listFind("create,redeploy",qSvcOperation.operation)>
|
||||
<!--- <cfif listFind("create,redeploy",qSvcOperation.operation)>
|
||||
<cfset CreateObject("component", "instance_operation_ls").checkResourceRealmId(qSvcOperation.resource_realm_id, qSvcOperation.instance_uid)/>
|
||||
<cfset setInstanceOperationRfsParam(arguments.instanceOperationUid, "resourceRealm", qSvcOperation.resource_realm)/><!--- *** для остальных операций не передаем? --->
|
||||
</cfif>
|
||||
<cfset setInstanceOperationRfsParam(arguments.instanceOperationUid, "resourceRealm", qSvcOperation.resource_realm)/>
|
||||
</cfif> --->
|
||||
|
||||
<cfquery name="qWriteRfsFromCfsParams">
|
||||
insert into instance_operation_param (instance_operation_uid,param,param_value)
|
||||
@@ -335,21 +337,85 @@
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="checkCfsResourceRealmAccess">
|
||||
<cfargument name="instanceOperationUid" type="guid">
|
||||
|
||||
<cfset var local={}/>
|
||||
|
||||
<!--- структура cfs и rfs параметров отличается, поэтому селекты разные --->
|
||||
<cfquery name="local.qParam">
|
||||
select sop.svc_operation_cfs_param
|
||||
from instance_operation io
|
||||
join instance e on (io.instance_uid=e.instance_uid)
|
||||
join svc_operation so on (e.service_id=so.svc_id)
|
||||
join svc_operation_cfs_param sop on (so.svc_operation_id=sop.svc_operation_id)
|
||||
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid("guid",arguments.instanceOperationUid)#/>
|
||||
AND LOWER(sop.svc_operation_cfs_param)=LOWER('resourceRealm')
|
||||
</cfquery><!--- Проверка на LOWER: возможная атака, поэтому трактуем расширенно --->
|
||||
|
||||
<cfif local.qParam.recordCount EQ 0>
|
||||
<cfreturn/><!--- нечего проверять --->
|
||||
</cfif>
|
||||
|
||||
<cfquery name="local.qOperation">
|
||||
select io.operation
|
||||
from instance_operation io
|
||||
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid("guid",arguments.instanceOperationUid)#/>
|
||||
</cfquery>
|
||||
|
||||
<cfquery name="local.qContract">
|
||||
select c.contract_id
|
||||
from instance_operation io
|
||||
join instance e on (io.instance_uid=e.instance_uid)
|
||||
join specification_item si on (e.specification_item_id=si.specification_item_id)
|
||||
join specification s on (si.specification_id=s.specification_id)
|
||||
join contract c on (s.contract_id=c.contract_id)
|
||||
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid("guid",arguments.instanceOperationUid)#/>
|
||||
</cfquery>
|
||||
|
||||
<!--- пробегаемся по CFS параметрам данной операции--->
|
||||
<cfquery name="local.qCheckResourceRealmAccess">
|
||||
select r.resource_realm_id, r.resource_realm, iop.param, iop.param_value, a.contract_id, a.is_enabled
|
||||
from resource_realm r
|
||||
join resource_realm_access a on (r.resource_realm_id=a.resource_realm_id)
|
||||
join instance_operation_cfs_param iop on (r.resource_realm=iop.param_value AND iop.param='resourceRealm')
|
||||
where iop.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid("guid",arguments.instanceOperationUid)#/>
|
||||
AND (a.contract_id=<cfqueryparam cfsqltype="CF_SQL_INTEGER" value=#local.qContract.contract_id# null=#!isValid("integer",local.qContract.contract_id)#/> OR a.contract_id=0)
|
||||
AND a.is_enabled
|
||||
</cfquery>
|
||||
|
||||
<cfif local.qCheckResourceRealmAccess.recordCount EQ 0>
|
||||
<cfthrow message="resource realm specified in CFS params is not available for current contract" detail="CFS resource realm unawailable. Instance operation UID #arguments.instanceOperationUid#. Contract ID #arguments.contractId#"/>
|
||||
<cfelse>
|
||||
<!--- <cfdump var=#local.qCheckResourceRealmAccess#/><cfabort/> --->
|
||||
<!--- <cfthrow detail="wefwewewewewewer2r24"/> --->
|
||||
</cfif>
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="checkRfsResourceRealmAccess">
|
||||
<cfargument name="instanceOperationUid" type="guid">
|
||||
|
||||
<cfset var local={}/>
|
||||
|
||||
<cfquery name="local.qParam">
|
||||
select iop.param
|
||||
from instance_operation io
|
||||
join instance_operation_param iop on (io.instance_operation_uid=iop.instance_operation_uid)
|
||||
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid("guid",arguments.instanceOperationUid)#/>
|
||||
AND LOWER(iop.param)=LOWER('resourceRealm')
|
||||
</cfquery> <!--- Проверка на LOWER: возможная атака, поэтому трактуем расширенно --->
|
||||
|
||||
<cfif local.qParam.recordCount EQ 0>
|
||||
<cfreturn/><!--- нечего проверять --->
|
||||
</cfif>
|
||||
|
||||
<cfquery name="local.qOperation">
|
||||
select io.operation
|
||||
from instance_operation io
|
||||
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid("guid",arguments.instanceOperationUid)#/>
|
||||
</cfquery>
|
||||
|
||||
<cfif !listFind("create,redeploy", local.qOperation.operation)>
|
||||
<cfreturn/>
|
||||
</cfif>
|
||||
|
||||
<cfquery name="local.qContract">
|
||||
select c.contract_id
|
||||
from instance_operation io
|
||||
@@ -372,7 +438,7 @@
|
||||
</cfquery>
|
||||
|
||||
<cfif local.qCheckResourceRealmAccess.recordCount EQ 0>
|
||||
<cfthrow message="resource realm specified in RFS params is not available for current contract" detail="resource realm unawailable. Instance operation UID #arguments.instanceOperationUid#. Contract ID #arguments.contractId#"/>
|
||||
<cfthrow message="resource realm specified in RFS params is not available for current contract" detail="RFS resource realm unawailable. Instance operation UID #arguments.instanceOperationUid#. Contract ID #arguments.contractId#"/>
|
||||
<cfelse>
|
||||
<!--- <cfdump var=#local.qCheckResourceRealmAccess#/><cfabort/> --->
|
||||
<!--- <cfthrow detail="wefwewewewewewer2r24"/> --->
|
||||
|
||||
Reference in New Issue
Block a user