diff --git a/v1/Application.cfc b/v1/Application.cfc index f157ea1..e0a4a48 100644 --- a/v1/Application.cfc +++ b/v1/Application.cfc @@ -51,7 +51,7 @@ //variables.framework.docs={}; 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["Access-Control-Expose-Headers"] = "Location"; @@ -117,7 +117,8 @@ - + @@ -175,9 +176,9 @@ } else { return representationOf("Authorization header expected").withStatus(401); } - + var result=""; 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 = "Authorization", value = "#auth#"); //passthrough //writedump(this.iamServiceUrl);abort; @@ -185,8 +186,15 @@ //if (resp.status_code NEQ 200) throw("IDP response not OK"); //writedump(resp);abort; var prefix = resp.getPrefix(); - if (prefix.status_code NEQ 200) throw("IDP response not OK"); - var result = prefix.filecontent; + if (prefix.status_code NEQ 200) { + writedump(this.iamServiceUrl); + writedump(resp); + + abort; + + throw("IDP response not OK"); + } + result = prefix.filecontent; //writedump(result);abort; } catch (e) { /*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); //return representationOf( {"exception"=e} ); - return representationOf( {"exception"=e, "idpResponse"=result} );//.withStatus(500); + return representationOf( {"exception"=e, "idpResponse"=result} ).withStatus(500); } //writeDump(result); abort; @@ -214,6 +222,8 @@ if (structIsEmpty(usrCustomerInfo)) return representationOf("Cannot find default specification for current user #result#").withStatus(422); //это создает довольно много лишних движений при отладке arguments.requestArguments.usrId=usrCustomerInfo.usrId; //Integer! + arguments.requestArguments.contragentId=usrCustomerInfo.contragentId; //Integer + arguments.requestArguments.contractId=usrCustomerInfo.contractId; //Integer arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //Integer return true; @@ -339,9 +349,9 @@ - + - select u.usr_id, s.specification_id + select u.usr_id, c.contragent_id, c.contract_id, s.specification_id from usr u join contract c on (u.contragent_id=c.contragent_id) join specification s on (c.contract_id=s.contract_id) @@ -350,7 +360,11 @@ - + diff --git a/v1/resources/instance.cfc b/v1/resources/instance.cfc index 7d58dd5..af9d1d2 100644 --- a/v1/resources/instance.cfc +++ b/v1/resources/instance.cfc @@ -47,7 +47,7 @@ left outer join usr u on (e.updater_id=u.usr_id) where e.instance_uid= AND s.specification_id= - + @@ -77,7 +77,6 @@ - diff --git a/v1/resources/instance_default.cfc b/v1/resources/instance_default.cfc index 5103b8e..d10ab72 100644 --- a/v1/resources/instance_default.cfc +++ b/v1/resources/instance_default.cfc @@ -7,7 +7,7 @@ - + diff --git a/v1/resources/instance_operation_default.cfc b/v1/resources/instance_operation_default.cfc index 57f47cf..6373380 100644 --- a/v1/resources/instance_operation_default.cfc +++ b/v1/resources/instance_operation_default.cfc @@ -8,7 +8,7 @@ - + diff --git a/v1/resources/instance_operation_run.cfc b/v1/resources/instance_operation_run.cfc index 857acde..2cad7fe 100644 --- a/v1/resources/instance_operation_run.cfc +++ b/v1/resources/instance_operation_run.cfc @@ -72,8 +72,10 @@ - - + + + + @@ -86,7 +88,7 @@ - + @@ -96,7 +98,7 @@ - + diff --git a/v1/resources/resource_realm_ls.cfc b/v1/resources/resource_realm_ls.cfc index 1928fc6..1fe46ad 100644 --- a/v1/resources/resource_realm_ls.cfc +++ b/v1/resources/resource_realm_ls.cfc @@ -65,10 +65,13 @@ from resource_realm r 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) - --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= + AND a.is_enabled) where 1=1 order by - --limit #maxrows# + limit #maxrows# diff --git a/v1/resources/svc_default.cfc b/v1/resources/svc_default.cfc index 863666b..376d955 100644 --- a/v1/resources/svc_default.cfc +++ b/v1/resources/svc_default.cfc @@ -7,7 +7,7 @@ - +