After the migration of genericBasePermissionCheck from mini-lang to groovy, I set a warning message to inform that we need to migrate simple-method call. But this simple-method is massively use on standard mini-lang script and finally populate with non interesting inform the log in production site. I down the level to inform only on development state git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868581 13f79535-47bb-0310-9956-ffa450edef68
71 lines
3.7 KiB
XML
71 lines
3.7 KiB
XML
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
-->
|
|
|
|
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
|
|
|
|
<simple-method method-name="genericBasePermissionCheck" short-description="Basic Permission check">
|
|
<!-- allow mainAction to be set from outside methods or direct to the service -->
|
|
<if-empty field="mainAction">
|
|
<set field="mainAction" from-field="parameters.mainAction"/>
|
|
<if-empty field="mainAction">
|
|
<add-error><fail-property resource="CommonUiLabels" property="CommonPermissionMainActionAttributeMissing"/></add-error>
|
|
</if-empty>
|
|
</if-empty>
|
|
<check-errors/>
|
|
|
|
<!-- allow primary permission to be set from outside methods or direct to the service -->
|
|
<if-empty field="primaryPermission">
|
|
<set field="primaryPermission" from-field="parameters.primaryPermission"/>
|
|
<if-empty field="primaryPermission">
|
|
<add-error><fail-property resource="CommonUiLabels" property="CommonPermissionPrimaryPermissionMissing"/></add-error>
|
|
</if-empty>
|
|
</if-empty>
|
|
<check-errors/>
|
|
<log level="verbose" message="Checking for primary permission ${primaryPermission}_${mainAction}"/>
|
|
|
|
<!-- allow alt permission to be set from outside methods or direct to the service -->
|
|
<if-empty field="altPermission">
|
|
<set field="altPermission" from-field="parameters.altPermission"/>
|
|
</if-empty>
|
|
<if-not-empty field="altPermission">
|
|
<log level="verbose" message="Checking for alternate permission ${altPermission}_${mainAction}"/>
|
|
<set field="altPermissionList" value=", ${altPermission}_${mainAction}, ${altPermission}_ADMIN"/>
|
|
</if-not-empty>
|
|
<!-- altPermission is not a required field; no need to add Error -->
|
|
|
|
<!-- set up called service name -->
|
|
<set field="resourceDescription" from-field="parameters.resourceDescription"/>
|
|
<if-empty field="resourceDescription">
|
|
<property-to-field resource="CommonUiLabels" property="CommonPermissionThisOperation" field="resourceDescription"/>
|
|
</if-empty>
|
|
|
|
<log level="info" message="This simple-method-call is deprecated! Please use a service-call of genericBasePermissionCheck instead."/>
|
|
<set field="inParams.altPermission" from-field="altPermission"/>
|
|
<set field="inParams.mainAction" from-field="parameters.mainAction"/>
|
|
<set field="inParams.primaryPermission" from-field="primaryPermission"/>
|
|
<set field="inParams.resourceDescription" from-field="parameters.resourceDescription"/>
|
|
<call-service service-name="genericBasePermissionCheck" in-map-name="inParams">
|
|
<result-to-field result-name="hasPermission"/>
|
|
</call-service>
|
|
<field-to-result field="hasPermission"/>
|
|
|
|
</simple-method>
|
|
</simple-methods>
|