Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
In the service def. replaced <check-permission> with <permission-serv…
Browse files Browse the repository at this point in the history
…ice> tag such that a permission checking is done using a permission

service. Also moved the permission checking logic to service definition.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@930551 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Vikas Mayur committed Apr 3, 2010
1 parent 3e5367a commit a24696f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ under the License.
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
<simple-method method-name="createShipmentReceipt" short-description="Create a ShipmentReceipt">
<check-permission permission="FACILITY" action="_CREATE"><fail-message message="Security Error: to run createShipmentReceipt you must have the FACILITY_CREATE or FACILITY_ADMIN permission"/></check-permission>
<check-errors/>

<make-value value-field="newEntity" entity-name="ShipmentReceipt"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>

Expand Down Expand Up @@ -51,9 +48,6 @@ under the License.
</simple-method>

<simple-method method-name="createShipmentReceiptRole" short-description="Create a ShipmentReceipt Role">
<check-permission permission="FACILITY" action="_CREATE"><fail-message message="Security Error: to run createShipmentReceiptRole you must have the FACILITY_CREATE or FACILITY_ADMIN permission"/></check-permission>
<check-errors/>

<make-value value-field="newEntity" entity-name="ShipmentReceiptRole"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
Expand All @@ -62,19 +56,13 @@ under the License.
</simple-method>

<simple-method method-name="removeShipmentReceiptRole" short-description="Remove a ShipmentReceipt Role">
<check-permission permission="FACILITY" action="_DELETE"><fail-message message="Security Error: to run removeShipmentReceiptRole you must have the FACILITY_DELETE or FACILITY_ADMIN permission"/></check-permission>
<check-errors/>

<make-value value-field="lookupPKMap" entity-name="ShipmentReceiptRole"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="ShipmentReceiptRole" map="lookupPKMap" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>

<simple-method method-name="receiveInventoryProduct" short-description="Receive Inventory in new Inventory Item(s)">
<check-permission permission="FACILITY" action="_CREATE"><fail-message message="Security Error: to run receiveInventoryProduct you must have the FACILITY_CREATE or FACILITY_ADMIN permission"/></check-permission>
<check-errors/>

<!-- NOTES
- for serialized items with a serial number passed in: the quantityAccepted _should_ always be 1
- if the type is SERIALIZED_INV_ITEM but there is not serial number (which is weird...) we'll create a bunch of individual InventoryItems
Expand Down Expand Up @@ -188,9 +176,6 @@ under the License.
</simple-method>

<simple-method method-name="quickReceiveReturn" short-description="Quick Receive Entire Return">
<check-permission permission="FACILITY" action="_CREATE"><fail-message message="Security Error: to run quickReceiveReturn you must have the FACILITY_CREATE or FACILITY_ADMIN permission"/></check-permission>
<check-errors/>

<entity-one entity-name="ReturnHeader" value-field="returnHeader">
<field-map field-name="returnId" from-field="parameters.returnId"/>
</entity-one>
Expand Down Expand Up @@ -316,12 +301,6 @@ under the License.

<simple-method method-name="issueOrderItemToShipmentAndReceiveAgainstPO" short-description="Issues order item quantity specified to the shipment, then receives inventory for that item and quantity">
<set value="Issue OrderItem to Shipment and Receive against PO" field="operationName"/>
<check-permission permission="FACILITY" action="_CREATE">
<fail-message message="Security Error: to run ${operationName} you must have the FACILITY_CREATE or FACILITY_ADMIN permission"/>
</check-permission>
<check-permission permission="FACILITY" action="_UPDATE">
<fail-message message="Security Error: to run ${operationName} you must have the FACILITY_UPDATE or FACILITY_ADMIN permission"/>
</check-permission>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml"/>

<!-- get orderItem -->
Expand Down
21 changes: 12 additions & 9 deletions applications/product/servicedef/services_shipment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,28 +103,22 @@ under the License.
<service name="createShipmentForReturn" default-entity-name="ReturnHeader" engine="simple"
location="component://product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="createShipmentForReturn">
<description>Create a Return Shipment with information from ReturnHeader fields</description>
<required-permissions join-type="AND">
<check-permission permission="FACILITY" action="_CREATE"/>
</required-permissions>
<permission-service service-name="facilityGenericPermission" main-action="CREATE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<attribute name="shipmentId" type="String" mode="OUT" optional="false"/>
</service>
<service name="createShipmentAndItemsForReturn" default-entity-name="ReturnHeader" engine="simple"
location="component://product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="createShipmentAndItemsForReturn">
<description>Create a Return Shipment and ShipmentItems with information from ReturnHeader and ReturnItems</description>
<required-permissions join-type="AND">
<check-permission permission="FACILITY" action="_CREATE"/>
</required-permissions>
<permission-service service-name="facilityGenericPermission" main-action="CREATE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<attribute name="shipmentId" type="String" mode="OUT" optional="false"/>
</service>

<service name="createShipmentAndItemsForVendorReturn" default-entity-name="Shipment" engine="simple"
location="component://product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="createShipmentAndItemsForVendorReturn">
<description>Create a Return Shipment and ShipmentItems with primaryReturnId</description>
<required-permissions join-type="AND">
<check-permission permission="FACILITY" action="_CREATE"/>
</required-permissions>
<permission-service service-name="facilityGenericPermission" main-action="CREATE"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
<attribute name="shipmentId" type="String" mode="OUT" optional="false"/>
<override name="primaryReturnId" optional="false"/>
Expand Down Expand Up @@ -733,6 +727,7 @@ under the License.
<service name="createShipmentReceipt" engine="simple"
location="component://product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="createShipmentReceipt" auth="true">
<description>Creates a ShipmentReceipt Record</description>
<permission-service service-name="facilityGenericPermission" main-action="CREATE"/>
<implements service="interfaceShipmentReceipt"/>
<attribute name="receiptId" type="String" mode="OUT" optional="false"/>
</service>
Expand All @@ -751,6 +746,7 @@ under the License.
<service name="receiveInventoryProduct" engine="simple" transaction-timeout="600"
location="component://product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="receiveInventoryProduct" auth="true">
<description>Receive Inventory In Warehouse</description>
<permission-service service-name="facilityGenericPermission" main-action="CREATE"/>
<auto-attributes entity-name="InventoryItem" include="nonpk" mode="IN" optional="true">
<exclude field-name="availableToPromiseTotal"/>
<exclude field-name="quantityOnHandTotal"/>
Expand All @@ -773,12 +769,17 @@ under the License.
<service name="issueOrderItemToShipmentAndReceiveAgainstPO" engine="simple" transaction-timeout="600"
location="component://product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="issueOrderItemToShipmentAndReceiveAgainstPO" auth="true">
<description>Issues order item quantity specified to the shipment, then receives inventory for that item and quantity</description>
<required-permissions join-type="AND">
<permission-service service-name="facilityGenericPermission" main-action="CREATE"/>
<permission-service service-name="facilityGenericPermission" main-action="UPDATE"/>
</required-permissions>
<implements service="issueOrderItemToShipment"/>
<implements service="receiveInventoryProduct"/>
</service>

<service name="quickReceiveReturn" engine="simple"
location="component://product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="quickReceiveReturn" auth="true">
<permission-service service-name="facilityGenericPermission" main-action="CREATE"/>
<attribute name="returnId" type="String" mode="IN" optional="false"/>
<attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/>
<attribute name="statusId" type="String" mode="IN" optional="true"/>
Expand All @@ -793,11 +794,13 @@ under the License.
<service name="createShipmentReceiptRole" engine="simple"
location="component://product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="createShipmentReceiptRole" auth="true">
<description>Create a ShipmentReceipt Role entry</description>
<permission-service service-name="facilityGenericPermission" main-action="CREATE"/>
<implements service="interfaceShipmentReceiptRole"/>
</service>
<service name="removeShipmentReceiptRole" engine="simple"
location="component://product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="removeShipmentReceiptRole" auth="true">
<description>Remove a ShipmentReceipt Role entry</description>
<permission-service service-name="facilityGenericPermission" main-action="DELETE"/>
<implements service="interfaceShipmentReceiptRole"/>
</service>

Expand Down

0 comments on commit a24696f

Please sign in to comment.