Author: jaz
Date: Wed Feb 14 06:43:41 2007 New Revision: 507548 URL: http://svn.apache.org/viewvc?view=rev&rev=507548 Log: can now use this permission as a service call; enabled required parameters to be passed in through the definition as well as inline minilang Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.properties ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml ofbiz/trunk/framework/common/servicedef/services.xml Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.properties?view=diff&rev=507548&r1=507547&r2=507548 ============================================================================== --- ofbiz/trunk/framework/common/config/CommonUiLabels.properties (original) +++ ofbiz/trunk/framework/common/config/CommonUiLabels.properties Wed Feb 14 06:43:41 2007 @@ -283,7 +283,8 @@ CommonPerform=Perform CommonPermissionErrorMessage=Security Error\: to run ${resourceDescription} you must have the EXAMPLE_${mainAction} or EXAMPLE_ADMIN permission CommonPermissionError=Permission Error -CommonPermissionMainActionAttributeMissing=Permission main-action attribute missing +CommonPermissionMainActionAttributeMissing=Permission main-action parameter missing! +CommonPermissionPrimaryPermissionMissing=Permission primaryPermission parameter missing! CommonGenericPermissionError=Security Error\: To run ${resourceDescription} you must have the ${}_${mainAction} or ${}_ADMIN permission CommonPerson=Person CommonPostedBy=Posted By Modified: ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml?view=diff&rev=507548&r1=507547&r2=507548 ============================================================================== --- ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml (original) +++ ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml Wed Feb 14 06:43:41 2007 @@ -21,17 +21,33 @@ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/simple-methods.xsd"> <simple-method method-name="genericBasePermissionCheck" short-description="Basic Permission check"> + <!-- allow primary permission to be set form outside methods or direct to the service --> + <if-empty field-name="primaryPermission"> + <set field="primaryPermission" from-field="parameters.primaryPermission"/> + </if-empty> + <if-empty field-name="primaryPermission"> + <add-error><fail-property resource="CommonUiLabels" property="CommonPermissionPrimaryPermissionMissing"/></add-error> + </if-empty> + + <!-- allow alt permission to be set form outside methods or direct to the service --> + <if-empty field-name="altPermission"> + <set field="altPermission" from-field="parameters.altPermission"/> + </if-empty> + <!-- altPermission is not a required field; no need to addError --> + <!-- allow mainAction to be set from outside methods --> <if-empty field-name="mainAction"> <set field="mainAction" from-field="parameters.mainAction"/> </if-empty> - <if-empty field-name="mainAction"> <add-error><fail-property resource="CommonUiLabels" property="CommonPermissionMainActionAttributeMissing"/></add-error> </if-empty> - <log level="verbose" message="Checking for ${primaryPermission}_${mainAction}"/> - <log level="verbose" message="Checking for ${altPermission}_${mainAction}"/> + + <log level="info" message="Checking for ${primaryPermission}_${mainAction}"/> + <log level="info" message="Checking for ${altPermission}_${mainAction}"/> <check-errors/> + + <!-- check permission --> <if> <condition> <or> Modified: ofbiz/trunk/framework/common/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?view=diff&rev=507548&r1=507547&r2=507548 ============================================================================== --- ofbiz/trunk/framework/common/servicedef/services.xml (original) +++ ofbiz/trunk/framework/common/servicedef/services.xml Wed Feb 14 06:43:41 2007 @@ -395,6 +395,8 @@ <service name="genericBasePermissionCheck" engine="simple" location="org/ofbiz/common/permission/CommonPermissionServices.xml" invoke="genericBasePermissionCheck"> <implements service="permissionInterface"/> + <attribute name="primaryPermission" type="String" mode="IN" optional="false"/> + <attribute name="altPermission" type="String" mode="IN" optional="true"/> </service> <!-- generic RSS feed interface --> |
Free forum by Nabble | Edit this page |