082 availableResourceRealms

This commit is contained in:
msyu
2025-04-07 22:29:03 +03:00
parent 498abdc060
commit 9692b6c101
7 changed files with 153 additions and 10 deletions
+28
View File
@@ -161,6 +161,25 @@
AND 1=0
</cfif>
order by so.svc_operation_id
</cfquery>
<cfquery name="local.qAvailableResourceRealm" result="local.result">
select
<m:field_set titleMapOut="local.realmTitleMap" lengthOut="local.realmFieldCount">
<m:field>r.resource_realm_id</m:field>
<m:field>r.resource_realm_type_id</m:field>
<m:field>r.resource_realm</m:field>
</m:field_set>
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
(r.resource_realm_id=a.resource_realm_id
AND a.contract_id=<cfqueryparam cfsqltype="CF_SQL_INTEGER" value=#arguments.contractId#/>
AND a.is_enabled)
join svc s on r.resource_realm_type_id=s.resource_realm_type_id
where s.svc_id=<cfqueryparam cfsqltype="CF_SQL_INTEGER" value=#qInstance.service_id#/>
order by 1
</cfquery>
<cfset var out=structNew("linked")/>
@@ -265,6 +284,11 @@
<cfloop query=#local.qAvailableOperation#>
<cfset arrayAppend(out.instance.availableOperations, this.helper.appendRecord(structNew("linked"), "", local.availableOperationTitleMap, local.qAvailableOperation, this.helper.snake2camel))/>
</cfloop>
<cfset "out.instance.availableResourceRealms"=[]/>
<cfloop query=#local.qAvailableResourceRealm#>
<cfset arrayAppend(out.instance.availableResourceRealms, this.helper.appendRecord(structNew("linked"), "", local.realmTitleMap, local.qAvailableResourceRealm, this.helper.snake2camel))/>
</cfloop>
<cfset "out.runDurationMs"=getTickCount() - request.startTickCount/>
<!--- <cfdump var=#local.qCurrentState#/>
@@ -277,6 +301,7 @@
<cffunction name="patch">
<cfargument name="instanceUid" type="string" required=true hint="type:guid"/>
<cfargument name="displayName" type="string" required=false hint="type:string"/>
<cfargument name="resourceRealmId" type="string" required=false hint="type:integer"/>
<cfargument name="descr" type="string" required=false default="" hint="type:varchar (no cleanup here!)"/>
<!--- ****** проверка уникальности --->
@@ -290,6 +315,9 @@
<cfif structKeyExists(arguments,"displayName")>
,display_name=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.displayName#" />
</cfif>
<cfif structKeyExists(arguments,"displayName")>
,resource_realm_id=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.resourceRealmId#" />
</cfif>
<cfif structKeyExists(arguments,"descr")>
,descr=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.descr#" />
</cfif>