svn commit: r611236 - in /ofbiz/trunk/applications/party: script/org/ofbiz/party/communication/CommunicationEventServices.xml script/org/ofbiz/party/party/PartyPermissionServices.xml servicedef/services.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r611236 - in /ofbiz/trunk/applications/party: script/org/ofbiz/party/communication/CommunicationEventServices.xml script/org/ofbiz/party/party/PartyPermissionServices.xml servicedef/services.xml

jleroux@apache.org
Author: jleroux
Date: Fri Jan 11 09:09:39 2008
New Revision: 611236

URL: http://svn.apache.org/viewvc?rev=611236&view=rev
Log:
A patch from Abhijit Meshram "Re-Factor Party CommunicationEvent permissions to follow new patterns." (https://issues.apache.org/jira/browse/OFBIZ-1563) - OFBIZ-1563


Modified:
    ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyPermissionServices.xml
    ofbiz/trunk/applications/party/servicedef/services.xml

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml?rev=611236&r1=611235&r2=611236&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml Fri Jan 11 09:09:39 2008
@@ -21,19 +21,6 @@
 <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="createCommunicationEvent" short-description="Create a CommunicationEvent">
-        <if>
-            <condition>
-                <and>
-                    <if-compare-field field-name="parameters.partyIdFrom" operator="not-equals" to-field-name="userLogin.partyId"/>
-                    <if-compare-field field-name="parameters.partyIdTo" operator="not-equals" to-field-name="userLogin.partyId"/>
-                </and>
-            </condition>
-            <then>
-                <check-permission permission="PARTYMGR" action="_CME_CREATE">
-                    <fail-property resource="PartyUiLabels" property="PartyCreateCommunicationEventPermissionError"/>
-                </check-permission>
-            </then>
-        </if>
 
         <if-empty field-name="parameters.statusId">
             <set value="COM_ENTERED" field="parameters.statusId"/>    
@@ -68,20 +55,12 @@
         </if-not-empty>
     </simple-method>
     <simple-method method-name="updateCommunicationEvent" short-description="Update a CommunicationEvent">
-        <check-permission permission="PARTYMGR" action="_CME_UPDATE">
-            <fail-property resource="PartyUiLabels" property="PartyUpdateCommunicationEventPermissionError"/>
-        </check-permission>
-        <check-errors/>
         
         <entity-one entity-name="CommunicationEvent" value-name="event"/>
         <set-nonpk-fields map-name="parameters" value-name="event"/>
         <store-value value-name="event"/>
     </simple-method>
     <simple-method method-name="deleteCommunicationEvent" short-description="Delete a CommunicationEvent">
-        <check-permission permission="PARTYMGR" action="_CME_DELETE">
-            <fail-property resource="PartyUiLabels" property="PartyUpdateCommunicationEventPermissionError"/>
-        </check-permission>
-        <check-errors/>
         
         <entity-one entity-name="CommunicationEvent" value-name="event"/>
         <!-- remove related links to content -->
@@ -119,10 +98,6 @@
         <remove-value value-name="event"/>
     </simple-method>
     <simple-method method-name="deleteCommunicationEventWorkEffort" short-description="delete commEvent and workEffort">
-        <check-permission permission="PARTYMGR" action="_CME_DELETE">
-            <fail-property resource="PartyUiLabels" property="PartyUpdateCommunicationEventPermissionError"/>
-        </check-permission>
-        <check-errors/>
         
         <entity-one entity-name="CommunicationEvent" value-name="event"/>
         <!-- remove related workeffort when this is the only communicationevent connected to it -->
@@ -148,10 +123,6 @@
     <!-- since these ancillary operations on communication event cause them to be updated,
         they will all use the CME_UPDATE permission -->
     <simple-method method-name="createCommunicationEventPurpose" short-description="Create a CommunicationEventPurpose">
-        <check-permission permission="PARTYMGR" action="_CME_UPDATE">
-            <fail-property resource="PartyUiLabels" property="PartyCreateCommunicationEventPurposePermissionError"/>
-        </check-permission>
-        <check-errors/>
         
         <make-value value-name="newEntity" entity-name="CommunicationEventPurpose"/>
         <set-pk-fields map-name="parameters" value-name="newEntity"/>
@@ -159,19 +130,11 @@
         <create-value value-name="newEntity"/>    
     </simple-method>
     <simple-method method-name="removeCommunicationEventPurpose" short-description="Remove a CommunicationEventPurpose">
-        <check-permission permission="PARTYMGR" action="_CME_UPDATE">
-            <fail-property resource="PartyUiLabels" property="PartyRemoveCommunicationEventPurposePermissionError"/>
-        </check-permission>
-        <check-errors/>
         
         <entity-one entity-name="CommunicationEventPurpose" value-name="eventPurpose"/>        
         <remove-value value-name="eventPurpose"/>
     </simple-method>
     <simple-method method-name="createCommunicationEventRole" short-description="Create a CommunicationEventRole">
-        <check-permission permission="PARTYMGR" action="_CME_UPDATE">
-            <fail-property resource="PartyUiLabels" property="PartyCreateCommunicationEventRolePermissionError"/>
-        </check-permission>
-        <check-errors/>
         
         <make-value value-name="newEntity" entity-name="CommunicationEventRole"/>
         <set-pk-fields map-name="parameters" value-name="newEntity"/>
@@ -179,10 +142,6 @@
         <create-value value-name="newEntity"/>    
     </simple-method>
     <simple-method method-name="removeCommunicationEventRole" short-description="Remove a CommunicationEventRole">
-        <check-permission permission="PARTYMGR" action="_CME_UPDATE">
-            <fail-property resource="PartyUiLabels" property="PartyRemoveCommunicationEventRolePermissionError"/>
-        </check-permission>
-        <check-errors/>
                 
         <entity-one entity-name="CommunicationEventRole" value-name="eventRole"/>        
         <remove-value value-name="eventRole"/>

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyPermissionServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyPermissionServices.xml?rev=611236&r1=611235&r2=611236&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyPermissionServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyPermissionServices.xml Fri Jan 11 09:09:39 2008
@@ -225,4 +225,8 @@
             <field-to-result field-name="failMessage"/>
         </if-compare>
     </simple-method>
+    <simple-method method-name="partyCommunicationEventPermissionCheck" short-description="Communication Event permission logic">
+        <set field="primaryPermission" value="PARTYMGR_CME"/>
+        <call-simple-method method-name="genericBasePermissionCheck" xml-resource="component://common/script/org/ofbiz/common/permission/CommonPermissionServices.xml"/>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=611236&r1=611235&r2=611236&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Fri Jan 11 09:09:39 2008
@@ -633,6 +633,7 @@
     <service name="createCommunicationEvent" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEvent" auth="true">
         <description>Create a Communication Event</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="CREATE"/>
         <auto-attributes entity-name="CommunicationEvent" include="nonpk" mode="IN" optional="true"/>
         <auto-attributes entity-name="CommunicationEvent" include="pk" mode="INOUT" optional="true"/>
         <attribute name="productId" type="String" mode="IN" optional="true"/>
@@ -641,12 +642,14 @@
     <service name="updateCommunicationEvent" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="updateCommunicationEvent" auth="true">
         <description>Update a Communication Event</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="UPDATE"/>
         <auto-attributes entity-name="CommunicationEvent" include="pk" mode="IN" optional="false"/>
         <auto-attributes entity-name="CommunicationEvent" include="nonpk" mode="IN" optional="true"/>
     </service>
     <service name="deleteCommunicationEvent" engine="simple"
         location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="deleteCommunicationEvent" auth="true">
         <description>Delete a Communication Event, optionally delete the attached content and dataresource</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="DELETE"/>
         <auto-attributes entity-name="CommunicationEvent" include="pk" mode="IN" optional="false"/>
         <attribute name="delContentDataResource" type="String" mode="IN" optional="true"/>
     </service>
@@ -654,29 +657,34 @@
         location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="deleteCommunicationEventWorkEffort" auth="true">
         <description>Delete a Communication Event, optionally delete the attached content and dataresource
             and when this is the only communication event connected to a workeffort delete the workeffort too.</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="DELETE"/>
         <auto-attributes entity-name="CommunicationEvent" include="pk" mode="IN" optional="false"/>
         <attribute name="delContentDataResource" type="String" mode="IN" optional="true"/>
     </service>
     <service name="createCommunicationEventPurpose" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEventPurpose" auth="true">
         <description>Create a Communication Event Purpose</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="CREATE"/>
         <auto-attributes entity-name="CommunicationEventPurpose" include="pk" mode="IN" optional="false"/>
         <auto-attributes entity-name="CommunicationEventPurpose" include="nonpk" mode="IN" optional="true"/>
     </service>
     <service name="removeCommunicationEventPurpose" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="removeCommunicationEventPurpose" auth="true">
         <description>Remove a Communication Event Purpose</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="UPDATE"/>
         <auto-attributes entity-name="CommunicationEventPurpose" include="pk" mode="IN" optional="false"/>
     </service>
     <service name="createCommunicationEventRole" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEventRole" auth="true">
         <description>Create a Communication Event Role</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="UPDATE"/>
         <auto-attributes entity-name="CommunicationEventRole" include="pk" mode="IN" optional="false"/>
         <auto-attributes entity-name="CommunicationEventRole" include="nonpk" mode="IN" optional="true"/>
     </service>
     <service name="removeCommunicationEventRole" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="removeCommunicationEventRole" auth="true">
         <description>Remove a Communication Event Role</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="UPDATE"/>
         <auto-attributes entity-name="CommunicationEventRole" include="pk" mode="IN" optional="false"/>
     </service>
     <service name="createCommEventWorkEffort" engine="simple" location="org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" invoke="makeCommunicationEventWorkEffort" auth="true"  >
@@ -990,5 +998,10 @@
         </description>
         <implements service="permissionInterface"/>
         <attribute name="partyInvitationId" type="String" mode="IN" optional="false"/>
+    </service>
+    <service name="partyCommunicationEventPermissionCheck" engine="simple"
+            location="component://party/script/org/ofbiz/party/party/PartyPermissionServices.xml" invoke="partyCommunicationEventPermissionCheck">
+        <description>Party CommunicationEvents Permission Checking Logic</description>
+        <implements service="permissionInterface"/>
     </service>
 </services>