067 usrId argument removed from annotations
This commit is contained in:
+24
-10
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
//variables.framework.docs={};
|
//variables.framework.docs={};
|
||||||
variables.framework.docs.APIName="Deck API";
|
variables.framework.docs.APIName="Deck API";
|
||||||
variables.framework.docs.APIVersion="0.066";
|
variables.framework.docs.APIVersion="0.067";
|
||||||
|
|
||||||
variables.framework.globalHeaders = structNew();
|
variables.framework.globalHeaders = structNew();
|
||||||
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
||||||
@@ -117,7 +117,8 @@
|
|||||||
|
|
||||||
<cfreturn serviceUrl/>
|
<cfreturn serviceUrl/>
|
||||||
<cfcatch type="any">
|
<cfcatch type="any">
|
||||||
<!--- <cfdump var=#cfcatch#/> --->
|
<!--- <cfdump var=#serviceUrl#/>
|
||||||
|
<cfdump var=#cfcatch#/><cfabort/> --->
|
||||||
</cfcatch>
|
</cfcatch>
|
||||||
</cftry>
|
</cftry>
|
||||||
</cfloop>
|
</cfloop>
|
||||||
@@ -175,9 +176,9 @@
|
|||||||
} else {
|
} else {
|
||||||
return representationOf("Authorization header expected").withStatus(401);
|
return representationOf("Authorization header expected").withStatus(401);
|
||||||
}
|
}
|
||||||
|
var result="";
|
||||||
try {
|
try {
|
||||||
var httpService = new http(method = "GET", charset = "utf-8", url = #this.iamServiceUrl#, timeout="3");
|
var httpService = new http(method = "GET", charset = "utf-8", url = #this.iamServiceUrl#, timeout="5");
|
||||||
httpService.addParam(type = "HEADER", name = "Accept", value = "application/json");
|
httpService.addParam(type = "HEADER", name = "Accept", value = "application/json");
|
||||||
httpService.addParam(type = "HEADER", name = "Authorization", value = "#auth#"); //passthrough
|
httpService.addParam(type = "HEADER", name = "Authorization", value = "#auth#"); //passthrough
|
||||||
//writedump(this.iamServiceUrl);abort;
|
//writedump(this.iamServiceUrl);abort;
|
||||||
@@ -185,8 +186,15 @@
|
|||||||
//if (resp.status_code NEQ 200) throw("IDP response not OK");
|
//if (resp.status_code NEQ 200) throw("IDP response not OK");
|
||||||
//writedump(resp);abort;
|
//writedump(resp);abort;
|
||||||
var prefix = resp.getPrefix();
|
var prefix = resp.getPrefix();
|
||||||
if (prefix.status_code NEQ 200) throw("IDP response not OK");
|
if (prefix.status_code NEQ 200) {
|
||||||
var result = prefix.filecontent;
|
writedump(this.iamServiceUrl);
|
||||||
|
writedump(resp);
|
||||||
|
|
||||||
|
abort;
|
||||||
|
|
||||||
|
throw("IDP response not OK");
|
||||||
|
}
|
||||||
|
result = prefix.filecontent;
|
||||||
//writedump(result);abort;
|
//writedump(result);abort;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/*if (fileExists("#GetDirectoryFromPath(GetCurrentTemplatePath())#/etc/local-debug")) { //true for local debug without IDP, etc/* does not go to repository
|
/*if (fileExists("#GetDirectoryFromPath(GetCurrentTemplatePath())#/etc/local-debug")) { //true for local debug without IDP, etc/* does not go to repository
|
||||||
@@ -194,7 +202,7 @@
|
|||||||
*/
|
*/
|
||||||
//writedump(resp);
|
//writedump(resp);
|
||||||
//return representationOf( {"exception"=e} );
|
//return representationOf( {"exception"=e} );
|
||||||
return representationOf( {"exception"=e, "idpResponse"=result} );//.withStatus(500);
|
return representationOf( {"exception"=e, "idpResponse"=result} ).withStatus(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
//writeDump(result); abort;
|
//writeDump(result); abort;
|
||||||
@@ -214,6 +222,8 @@
|
|||||||
|
|
||||||
if (structIsEmpty(usrCustomerInfo)) return representationOf("Cannot find default specification for current user #result#").withStatus(422); //это создает довольно много лишних движений при отладке
|
if (structIsEmpty(usrCustomerInfo)) return representationOf("Cannot find default specification for current user #result#").withStatus(422); //это создает довольно много лишних движений при отладке
|
||||||
arguments.requestArguments.usrId=usrCustomerInfo.usrId; //Integer!
|
arguments.requestArguments.usrId=usrCustomerInfo.usrId; //Integer!
|
||||||
|
arguments.requestArguments.contragentId=usrCustomerInfo.contragentId; //Integer
|
||||||
|
arguments.requestArguments.contractId=usrCustomerInfo.contractId; //Integer
|
||||||
arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //Integer
|
arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //Integer
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -339,9 +349,9 @@
|
|||||||
<cfset local={}/>
|
<cfset local={}/>
|
||||||
|
|
||||||
<!--- Во избежании потери времени при отладке временно сделаем создание дефолтового контракта и спецификации, если их нет --->
|
<!--- Во избежании потери времени при отладке временно сделаем создание дефолтового контракта и спецификации, если их нет --->
|
||||||
|
<!--- *** хватается первый попавшийся контракт и спецификация --->
|
||||||
<cfquery name="local.qGetCustomerInfo">
|
<cfquery name="local.qGetCustomerInfo">
|
||||||
select u.usr_id, s.specification_id
|
select u.usr_id, c.contragent_id, c.contract_id, s.specification_id
|
||||||
from usr u
|
from usr u
|
||||||
join contract c on (u.contragent_id=c.contragent_id)
|
join contract c on (u.contragent_id=c.contragent_id)
|
||||||
join specification s on (c.contract_id=s.contract_id)
|
join specification s on (c.contract_id=s.contract_id)
|
||||||
@@ -350,7 +360,11 @@
|
|||||||
</cfquery>
|
</cfquery>
|
||||||
<!--- <cfdump var=#local.qGetCustomerInfo#/><cfabort/> --->
|
<!--- <cfdump var=#local.qGetCustomerInfo#/><cfabort/> --->
|
||||||
<cfif local.qGetCustomerInfo.recordCount GT 0>
|
<cfif local.qGetCustomerInfo.recordCount GT 0>
|
||||||
<cfreturn {"usrId"=#local.qGetCustomerInfo.usr_id#, "specificationId"=#local.qGetCustomerInfo.specification_id#}/>
|
<cfreturn {"usrId"=#local.qGetCustomerInfo.usr_id#,
|
||||||
|
"contragentId"=#local.qGetCustomerInfo.specification_id#,
|
||||||
|
"contractId"=#local.qGetCustomerInfo.specification_id#,
|
||||||
|
"specificationId"=#local.qGetCustomerInfo.specification_id#
|
||||||
|
}/>
|
||||||
<cfelse>
|
<cfelse>
|
||||||
<cfreturn {}/> <!--- неуклюжий способ обозначить ошибку --->
|
<cfreturn {}/> <!--- неуклюжий способ обозначить ошибку --->
|
||||||
</cfif>
|
</cfif>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
left outer join usr u on (e.updater_id=u.usr_id)
|
left outer join usr u on (e.updater_id=u.usr_id)
|
||||||
where e.instance_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceUid#" null=#!isValid('guid',arguments.instanceUid)#/>
|
where e.instance_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceUid#" null=#!isValid('guid',arguments.instanceUid)#/>
|
||||||
AND s.specification_id=<cfqueryparam cfsqltype="cf_sql_integer" value=#arguments.specificationId#/><!--- access protection --->
|
AND s.specification_id=<cfqueryparam cfsqltype="cf_sql_integer" value=#arguments.specificationId#/><!--- access protection --->
|
||||||
</cfquery> <!--- *** правильнее при попытке доступа к чужому инстансу (НСД) выбрасывать 403, а тут будет 404 --->
|
</cfquery> <!--- *** правильнее при попытке доступа к чужому инстансу (НСД) выбрасывать 403, а тут будет 404, но так тоже делают, например, в gitea --->
|
||||||
|
|
||||||
<cfif local.qInstance.recordCount EQ 0>
|
<cfif local.qInstance.recordCount EQ 0>
|
||||||
<cfreturn representationOf("Instance not found or no permission to view").withStatus(404)/>
|
<cfreturn representationOf("Instance not found or no permission to view").withStatus(404)/>
|
||||||
@@ -77,7 +77,6 @@
|
|||||||
|
|
||||||
<!--- <cfdump var=#local.qInstance#/><cfabort/> --->
|
<!--- <cfdump var=#local.qInstance#/><cfabort/> --->
|
||||||
|
|
||||||
|
|
||||||
<!--- операция, создавшая текущее состояние --->
|
<!--- операция, создавшая текущее состояние --->
|
||||||
<!--- *** странноватый селект --->
|
<!--- *** странноватый селект --->
|
||||||
<cfquery name="local.qOperation" result="local.result">
|
<cfquery name="local.qOperation" result="local.result">
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<cffunction name="get" hint="Шаблон экземпляра"><!--- *** TODO проверка принадлежности тенанту --->
|
<cffunction name="get" hint="Шаблон экземпляра"><!--- *** TODO проверка принадлежности тенанту --->
|
||||||
<cfargument name="svcId" type="string" required=true hint="type:integer"/>
|
<cfargument name="svcId" type="string" required=true hint="type:integer"/>
|
||||||
<cfargument name="usrId" type="string" required=true hint="type:integer"/><!--- arguments.usrId неявно вбрасывается из Application.cfm --->
|
<!--- <cfargument name="usrId" type="string" hint="type:integer; no need to provide this argument in request, it is injected by IAM"/> ---><!--- arguments.usrId неявно вбрасывается из Application.cfm --->
|
||||||
|
|
||||||
<cftry>
|
<cftry>
|
||||||
<cfset this.helper.validateField(arguments, "svcId", "integer")/>
|
<cfset this.helper.validateField(arguments, "svcId", "integer")/>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<cffunction name="get" hint="Шаблон операции экземпляра"><!--- *** TODO проверка принадлежности тенанту --->
|
<cffunction name="get" hint="Шаблон операции экземпляра"><!--- *** TODO проверка принадлежности тенанту --->
|
||||||
<cfargument name="svcOperationId" type="string" required=true hint="type:integer"/>
|
<cfargument name="svcOperationId" type="string" required=true hint="type:integer"/>
|
||||||
<cfargument name="usrId" type="string" required=true hint="type:integer"/><!--- arguments.usrId неявно инжектируется из Application.cfm --->
|
<!--- <cfargument name="usrId" type="string" hint="type:integer; no need to provide this argument in request, it is injected by IAM"/> ---><!--- arguments.usrId неявно инжектируется из Application.cfm --->
|
||||||
|
|
||||||
<cftry>
|
<cftry>
|
||||||
<cfset this.helper.validateField(arguments, "svcOperationId", "integer")/>
|
<cfset this.helper.validateField(arguments, "svcOperationId", "integer")/>
|
||||||
|
|||||||
@@ -74,6 +74,8 @@
|
|||||||
</cfif>
|
</cfif>
|
||||||
</cfloop><!--- <cfdump var=#local.qCheckCfsParams#/><cfabort/> --->
|
</cfloop><!--- <cfdump var=#local.qCheckCfsParams#/><cfabort/> --->
|
||||||
|
|
||||||
|
<!--- ***** тут должен быть контроль доступа на уровне параметров. Желательно по максимуму параноидальный --->
|
||||||
|
<!--- ***** или при сабмите. Может быть, и на уровне RFS параметров тоже --->
|
||||||
<cfset generateRfsParams(arguments.instanceOperationUid, arguments.usrId)/>
|
<cfset generateRfsParams(arguments.instanceOperationUid, arguments.usrId)/>
|
||||||
<cfset submitJob(arguments.instanceOperationUid)/>
|
<cfset submitJob(arguments.instanceOperationUid)/>
|
||||||
|
|
||||||
@@ -86,7 +88,7 @@
|
|||||||
</cftry>
|
</cftry>
|
||||||
<!--- <cfreturn representationOf("Not Implemented yet").withStatus(501)/> --->
|
<!--- <cfreturn representationOf("Not Implemented yet").withStatus(501)/> --->
|
||||||
|
|
||||||
<cfset generateRfsParams(arguments.instanceOperationUid)/>
|
<cfset generateRfsParams(arguments.instanceOperationUid)/><!--- *** а это зачем? прокомментировать --->
|
||||||
|
|
||||||
<!--- --->
|
<!--- --->
|
||||||
<cfreturn noData().withStatus(201, "Created") />
|
<cfreturn noData().withStatus(201, "Created") />
|
||||||
@@ -96,7 +98,7 @@
|
|||||||
|
|
||||||
<cffunction name="generateRfsParams">
|
<cffunction name="generateRfsParams">
|
||||||
<cfargument name="instanceOperationUid" type="guid"/>
|
<cfargument name="instanceOperationUid" type="guid"/>
|
||||||
<cfargument name="usrId" type="numeric"/>
|
<cfargument name="usrId" type="numeric"/><!--- *** инжектируется? --->
|
||||||
<!---
|
<!---
|
||||||
-- полезный селект, не выбрасывать
|
-- полезный селект, не выбрасывать
|
||||||
<cfquery name="qSvcOperationCfsParam">
|
<cfquery name="qSvcOperationCfsParam">
|
||||||
@@ -256,6 +258,7 @@
|
|||||||
|
|
||||||
</cffunction>
|
</cffunction>
|
||||||
|
|
||||||
|
<!--- *** судя по всему, RFS параметр не обязан быть специфицирован на сервисе (никак не проверяется) --->
|
||||||
<cffunction name="setInstanceOperationRfsParam">
|
<cffunction name="setInstanceOperationRfsParam">
|
||||||
<cfargument name="instanceOperationUid" type="guid">
|
<cfargument name="instanceOperationUid" type="guid">
|
||||||
<cfargument name="param"><!--- значение не должно содержать лишних пробелов, чувствительность к регистру определяется БД --->
|
<cfargument name="param"><!--- значение не должно содержать лишних пробелов, чувствительность к регистру определяется БД --->
|
||||||
|
|||||||
@@ -65,10 +65,13 @@
|
|||||||
from resource_realm r
|
from resource_realm r
|
||||||
join resource_realm_type t on (r.resource_realm_type_id=t.resource_realm_type_id)
|
join resource_realm_type t on (r.resource_realm_type_id=t.resource_realm_type_id)
|
||||||
left outer join resource_realm p on (r.parent_id=p.resource_realm_id)
|
left outer join resource_realm p on (r.parent_id=p.resource_realm_id)
|
||||||
--join resource_realm_access a on a.
|
join resource_realm_access a on
|
||||||
|
(r.resource_realm_id=a.resource_realm_id
|
||||||
|
AND a.contract_id=<cfqueryparam cfsqltype="CF_SQL_INTEGER" value=#arguments.contractId#/>
|
||||||
|
AND a.is_enabled)
|
||||||
where 1=1 <m:filter_build filter=#filter#/>
|
where 1=1 <m:filter_build filter=#filter#/>
|
||||||
order by <m:order_build sortCollection=#this.helper.parseNumericOrder(local.titleMap, arguments.orderBy)# fieldCount=0/><!---no sort length limit--->
|
order by <m:order_build sortCollection=#this.helper.parseNumericOrder(local.titleMap, arguments.orderBy)# fieldCount=0/><!---no sort length limit--->
|
||||||
--limit #maxrows#
|
limit #maxrows#
|
||||||
</cfquery>
|
</cfquery>
|
||||||
|
|
||||||
<cftry>
|
<cftry>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<cffunction name="get" hint="Шаблон экземпляра"><!--- *** TODO проверка принадлежности тенанту --->
|
<cffunction name="get" hint="Шаблон экземпляра"><!--- *** TODO проверка принадлежности тенанту --->
|
||||||
<cfargument name="svcId" type="string" required=true hint="type:integer"/>
|
<cfargument name="svcId" type="string" required=true hint="type:integer"/>
|
||||||
<cfargument name="usrId" type="string" required=true hint="type:integer"/><!--- arguments.usrId неявно вбрасывается из Application.cfm --->
|
<!--- <cfargument name="usrId" type="string" /> ---><!--- arguments.usrId неявно инжектируется из Application.cfm --->
|
||||||
|
|
||||||
<cftry>
|
<cftry>
|
||||||
<cfset this.helper.validateField(arguments, "svcId", "integer")/>
|
<cfset this.helper.validateField(arguments, "svcId", "integer")/>
|
||||||
|
|||||||
Reference in New Issue
Block a user