diff --git a/v1/Application.cfc b/v1/Application.cfc index 4d7aaf3..2a51488 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.088"; + variables.framework.docs.APIVersion="0.089"; variables.framework.globalHeaders = structNew(); variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location"; diff --git a/v1/resources/instance.cfc b/v1/resources/instance.cfc index 66758fc..67c0dc8 100644 --- a/v1/resources/instance.cfc +++ b/v1/resources/instance.cfc @@ -163,24 +163,6 @@ order by so.svc_operation_id - diff --git a/v1/resources/instance_default.cfc b/v1/resources/instance_default.cfc index 86ada7d..039ce05 100644 --- a/v1/resources/instance_default.cfc +++ b/v1/resources/instance_default.cfc @@ -29,31 +29,6 @@ order by 1 - - - - diff --git a/v1/resources/instance_operation.cfc b/v1/resources/instance_operation.cfc index 3a2d0e1..46a634a 100644 --- a/v1/resources/instance_operation.cfc +++ b/v1/resources/instance_operation.cfc @@ -143,7 +143,8 @@ /*left outer join resource_realm p on (r.parent_id=p.resource_realm_id)*/ join resource_realm_access a on (r.resource_realm_id=a.resource_realm_id - AND a.contract_id= + AND (a.contract_id= + OR a.contract_id=0) /*0 means access to any contract*/ AND a.is_enabled) join svc s on r.resource_realm_type_id=s.resource_realm_type_id where s.svc_id= diff --git a/v1/resources/instance_operation_default.cfc b/v1/resources/instance_operation_default.cfc index a2d795d..9520165 100644 --- a/v1/resources/instance_operation_default.cfc +++ b/v1/resources/instance_operation_default.cfc @@ -85,7 +85,8 @@ /*left outer join resource_realm p on (r.parent_id=p.resource_realm_id)*/ join resource_realm_access a on (r.resource_realm_id=a.resource_realm_id - AND a.contract_id= + AND (a.contract_id= + OR a.contract_id=0) /*0 means access to any contract*/ AND a.is_enabled) join svc s on r.resource_realm_type_id=s.resource_realm_type_id where s.svc_id= diff --git a/v1/resources/instance_operation_ls.cfc b/v1/resources/instance_operation_ls.cfc index 3bfb363..e66b190 100644 --- a/v1/resources/instance_operation_ls.cfc +++ b/v1/resources/instance_operation_ls.cfc @@ -7,6 +7,7 @@ + @@ -30,7 +31,9 @@ - + + + @@ -68,21 +71,60 @@ /> - + + - - + - - + - Проверить соответствие сервису - Проверить доступ (это предварительная проверка! настоящая проверка перед запуском операции) + + select c.contract_id + from instance e + 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 e.instance_uid= + + + select r.resource_realm_type_id + from resource_realm r + join resource_realm_type t on (r.resource_realm_type_id=t.resource_realm_type_id) + join svc s on (t.resource_realm_type_id=s.resource_realm_type_id) + join instance e on (s.svc_id=e.service_id) + where r.resource_realm_id= + AND e.instance_uid= + + + + + + + select r.resource_realm_id + from resource_realm r + join resource_realm_access a on (r.resource_realm_id=a.resource_realm_id) + where r.resource_realm_id= + AND (a.contract_id= + OR a.contract_id=0) + AND a.is_enabled + + + + + + diff --git a/v1/resources/instance_operation_run.cfc b/v1/resources/instance_operation_run.cfc index bc072c6..c8ce890 100644 --- a/v1/resources/instance_operation_run.cfc +++ b/v1/resources/instance_operation_run.cfc @@ -9,7 +9,7 @@ - + @@ -78,7 +78,9 @@ - + + + @@ -107,7 +109,7 @@ - select so.svc_operation_id, io.instance_uid, so.operation, r.resource_realm + select so.svc_operation_id, io.instance_uid, so.operation, r.resource_realm, io.resource_realm_id 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 AND io.operation=so.operation) @@ -118,12 +120,17 @@ - + + + + + + insert into instance_operation_param (instance_operation_uid,param,param_value) @@ -269,9 +276,10 @@ - - - + + + + insert into instance_operation_param (instance_operation_uid,param,param_value) values ( @@ -325,5 +333,50 @@ + + + + + + + + + select io.operation + from instance_operation io + where io.instance_operation_uid= + + + + + + + + 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= + + + + + 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_param iop on (r.resource_realm=iop.param_value AND iop.param='resourceRealm') + where iop.instance_operation_uid= + AND (a.contract_id= OR a.contract_id=0) + AND a.is_enabled + + + + + + + + + \ No newline at end of file diff --git a/v1/resources/resource_realm_ls.cfc b/v1/resources/resource_realm_ls.cfc index 1fe46ad..d2e35e0 100644 --- a/v1/resources/resource_realm_ls.cfc +++ b/v1/resources/resource_realm_ls.cfc @@ -16,7 +16,7 @@ } /> - + @@ -67,7 +67,8 @@ left outer join resource_realm p on (r.parent_id=p.resource_realm_id) join resource_realm_access a on (r.resource_realm_id=a.resource_realm_id - AND a.contract_id= + AND (a.contract_id= + OR a.contract_id=0) AND a.is_enabled) where 1=1 order by