Author: hansbak
Date: Thu Jan  8 01:54:37 2009
New Revision: 732666

URL: http://svn.apache.org/viewvc?rev=732666&view=rev
Log:
add permission services to myportal

Modified:
    ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml
    
ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/MyPortalServices.xml
    ofbiz/trunk/specialpurpose/myportal/servicedef/services.xml
    ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml

Modified: ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml?rev=732666&r1=732665&r2=732666&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml Thu Jan  8 
01:54:37 2009
@@ -58,39 +58,31 @@
     <PortalPageColumn portalPageId="00012" columnSeqId="00001" />
     <PortalPageColumn portalPageId="00010" columnSeqId="00002" 
columnWidthPercentage="50" />
     
-    <PortalPortlet portalPortletId="Attributes" portletName="Attributes" 
screenName="Attributes" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Attributes in myportal from party"/>
+    <PortalPortlet portalPortletId="Attributes" portletName="Attributes" 
screenName="Attributes" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Attributes in myportal from party" />
     <PortalPortlet portalPortletId="AvsSettings" portletName="Avs Settings" 
screenName="AvsSettings" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Avs Settings in myportal from party" />
     <PortalPortlet portalPortletId="Content" portletName="Content" 
screenName="Content" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Content in myportal from party" />
     <PortalPortlet portalPortletId="LoyaltyPoints" portletName="Loyalty 
Points" screenName="LoyaltyPoints" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Loyalty Points in myportal from party" />
     <PortalPortlet portalPortletId="MYTASKSPARTY" portletName="My Tasks From 
Party" screenName="mytasksParty" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="My Tasks in myportal from party" />
-    <PortalPortlet portalPortletId="Notes" portletName="Notes" 
screenName="Notes" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Notes in myportal from party" />
+    <PortalPortlet portalPortletId="Notes" portletName="Notes" 
screenName="Notes" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Notes in myportal from party" />    
     <PortalPortlet portalPortletId="PaymentMethods" portletName="Payment 
Methods" screenName="PaymentMethods" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="PaymentMethods in myportal from party" />
     <PortalPortlet portalPortletId="ShipperAccount" portletName="Shipper 
Account" screenName="ShipperAccount" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Shipper Account in myportal from party" />
     <PortalPortlet portalPortletId="UserLogin" portletName="User Login" 
screenName="UserLogin" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="User Login in myportal from party" />
-    <PortalPortlet portalPortletId="ViewInternalOrg" portletName="View 
Internal Org" screenName="ViewInternalOrg" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="View Internal Org in myportal from party" />
     <PortalPortlet portalPortletId="Visits" portletName="Visits" 
screenName="Visits" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Visits in myportal from party" />
     <PortalPortlet portalPortletId="contact" portletName="Contact" 
screenName="Contact" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="contact in myportal from party" />
-    <PortalPortlet portalPortletId="listrequestlist" portletName="List Request 
List" screenName="ListRequestList" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Request List From My Page" />
-    <PortalPortlet portalPortletId="mycommunications" portletName="My 
Communications" screenName="MyCommunications" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="My Communications From My Page" />
-    <PortalPortlet portalPortletId="mycompanycomms" portletName="My Company 
Comms" screenName="MyCompanyComms" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="My Company Comms From My Page" />
-    <PortalPortlet portalPortletId="mytasks" portletName="My Tasks" 
screenName="MyTasks" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="My Tasks From My Page" />
-    <PortalPortlet portalPortletId="mytimesheet" portletName="My Timesheet" 
screenName="MyTimesheet" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="My Timesheet From My Page" />
-    <PortalPortlet portalPortletId="otherCommunications" portletName="Other 
Communications" screenName="OtherCommunications" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Other Communications From My Page" />
+    <PortalPortlet portalPortletId="listrequestlist" portletName="List Request 
List" screenName="ListRequestList" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Request List From My Page" 
securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="mycommunications" portletName="My 
Communications" screenName="MyCommunications" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="My Communications From My Page" 
securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="mycompanycomms" portletName="My Company 
Comms" screenName="MyCompanyComms" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="My Company Comms From My Page" 
securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="mytasks" portletName="My Tasks" 
screenName="MyTasks" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="My Tasks From My Page" 
securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />   
 
+    <PortalPortlet portalPortletId="mytimesheet" portletName="My Timesheet" 
screenName="MyTimesheet" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="My Timesheet From My Page" 
securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="otherCommunications" portletName="Other 
Communications" screenName="OtherCommunications" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Other Communications From My Page" 
securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
     <PortalPortlet portalPortletId="party" portletName="Party" 
screenName="Party" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="profile in myportal from party" />
-    <PortalPortlet portalPortletId="contactsAndAccounts" portletName="Contacts 
And Accounts" screenName="contactsAndAccounts" 
screenLocation="component://example/widget/example/PortletScreens.xml" 
description="Contacts And Accounts From My Page" />
-    <PortalPortlet portalPortletId="FinAccounts" portletName="FinAccounts" 
screenName="FinAccounts" 
screenLocation="component://example/widget/example/PortletScreens.xml" 
description="FinAccounts in myportal from party" />
-    <PortalPortlet portalPortletId="Cart" portletName="Cart" screenName="Cart" 
screenLocation="component://example/widget/example/PortletScreens.xml" 
description="Cart in myportal from party" />
-    <PortalPortlet portalPortletId="SerializedInventory" 
portletName="Serialized Inventory" screenName="SerializedInventory" 
screenLocation="component://example/widget/example/PortletScreens.xml" 
description="Serialized Inventory in myportal from party" />
-    <PortalPortlet portalPortletId="Subscriptions" portletName="Sub 
Scriptions" screenName="Subscriptions" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Sub Scriptions in myportal from party" />
-    <PortalPortlet portalPortletId="Communications" 
portletName="Communications" screenName="Communications" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Communications From MyPortal" />
-    <PortalPortlet portalPortletId="ListInvoices" portletName="List Invoices" 
screenName="ListInvoices" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Invoices From MyPortal" />
-    <PortalPortlet portalPortletId="ListCustRequests" portletName="List Cust 
Requests" screenName="ListCustRequests" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Cust Requests From MyPortal" />
-    <PortalPortlet portalPortletId="ListCustRequestsComp" portletName="List 
Cust Requests Completed" screenName="ListCustRequestsCompleted" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Cust Requests Completed From MyPortal" />
-    <PortalPortlet portalPortletId="ListPartyCommEvents" portletName="List 
Party Comm Events" screenName="ListPartyCommEvents" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Party Comm Events in myportal from party" />
-    <PortalPortlet portalPortletId="ContentList" portletName="Content List" 
screenName="ContentList" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="Content List in myportal from party" />
-    <PortalPortlet portalPortletId="ListProjects" portletName="List Projects" 
screenName="ListProjects" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Projects From MyPortal" />
-    <PortalPortlet portalPortletId="WELCOME" portletName="Welcome" 
screenName="welcomePortlet" 
screenLocation="component://common/widget/PortletScreens.xml" 
description="OFBiz Welcome Message" />
-    <PortalPortlet portalPortletId="LOGIN" portletName="Login" 
screenName="loginPortlet" 
screenLocation="component://common/widget/PortletScreens.xml" 
editFormName="LoginPortletEdit" 
editFormLocation="component://common/widget/PortletEditForms.xml" 
description="Login Form" />
+    <PortalPortlet portalPortletId="ListInvoices" portletName="List Invoices" 
screenName="ListInvoices" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Invoices From MyPortal" 
securityServiceName="portalPermissionIsCustomer" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="ListCustRequests" portletName="List Cust 
Requests" screenName="ListCustRequests" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Cust Requests From MyPortal" 
securityServiceName="portalPermissionIsCustomer" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="ListCustRequestsComp" portletName="List 
Cust Requests Completed" screenName="ListCustRequestsCompleted" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Cust Requests Completed From MyPortal" 
securityServiceName="portalPermissionIsCustomer" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="ListPartyCommEvents" portletName="List 
Party Comm Events" screenName="ListPartyCommEvents" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Party Comm Events in myportal from party" 
securityServiceName="portalPermissionIsCustomer" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="ListProjects" portletName="List Projects" 
screenName="ListProjects" 
screenLocation="component://myportal/widget/MyPortalScreens.xml" 
description="List Projects From MyPortal" 
securityServiceName="portalPermissionIsCustomer" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="WELCOME" portletName="Welcome" 
screenName="welcomePortlet" 
screenLocation="component://common/widget/PortletScreens.xml" 
description="OFBiz Welcome Message" 
securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="LOGIN" portletName="Login" 
screenName="loginPortlet" 
screenLocation="component://common/widget/PortletScreens.xml" 
editFormName="LoginPortletEdit" 
editFormLocation="component://common/widget/PortletEditForms.xml" 
description="Login Form" securityServiceName="portalPermissionIsEmployee" 
securityMainAction="VIEW" />
     
     <PortalPagePortlet portalPageId="MYPORTAL" 
portalPortletId="listrequestlist" portletSeqId="00001" columnSeqId="00001" />   
 
     <PortalPagePortlet portalPageId="00001" portalPortletId="party" 
portletSeqId="00001" columnSeqId="00001" sequenceNum="0" />

Modified: 
ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/MyPortalServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/MyPortalServices.xml?rev=732666&r1=732665&r2=732666&view=diff
==============================================================================
--- 
ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/MyPortalServices.xml
 (original)
+++ 
ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/MyPortalServices.xml
 Thu Jan  8 01:54:37 2009
@@ -121,5 +121,34 @@
                 </if-not-empty>
             </then>
         </if>
-    </simple-method>    
+    </simple-method>        
+    
+    <simple-method method-name="portalPermissionIsEmployee" 
short-description="check permission for Employee">
+        <set field="hasPermission" value="true" type="Boolean"/>
+        <set field="hasNoPermission" value="false" type="Boolean"/>
+        
+        <if-has-permission permission="MYPORTAL_EMPLOYEE">
+            <field-to-result field="hasPermission"/>
+            <return/>
+            <else>
+                <field-to-result field="hasNoPermission" 
result-name="hasPermission"/>
+                <return/>
+            </else>
+        </if-has-permission>
+    </simple-method>
+    
+    <simple-method method-name="portalPermissionIsCustomer" 
short-description="check permission for customer">
+        <set field="hasPermission" value="true" type="Boolean"/>
+        <set field="hasNoPermission" value="false" type="Boolean"/>
+        
+        <if-has-permission permission="MYPORTAL_CUSTOMER">
+            <field-to-result field="hasPermission"/>
+            <return/>
+            <else>
+                <field-to-result field="hasNoPermission" 
result-name="hasPermission"/>
+                <return/>
+            </else>
+        </if-has-permission>
+    </simple-method>
+    
 </simple-methods>

Modified: ofbiz/trunk/specialpurpose/myportal/servicedef/services.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/servicedef/services.xml?rev=732666&r1=732665&r2=732666&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/servicedef/services.xml Thu Jan  8 
01:54:37 2009
@@ -28,5 +28,15 @@
         <attribute name="custRequestId" type="String" mode="IN"/>
         <auto-attributes mode="IN" include="pk" optional="false"/>
         <auto-attributes include="nonpk" mode="OUT" optional="true"/>
-    </service>   
+    </service>       
+    
+    <!-- check access in permission service -->
+    <service name="portalPermissionIsEmployee" engine="simple"
+        location="org/ofbiz/myportal/MyPortalServices.xml" 
invoke="portalPermissionIsEmployee">
+        <implements service="permissionInterface"/>
+    </service>
+    <service name="portalPermissionIsCustomer" engine="simple"
+        location="org/ofbiz/myportal/MyPortalServices.xml" 
invoke="portalPermissionIsCustomer">
+        <implements service="permissionInterface"/>
+    </service>
 </services>

Modified: ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml?rev=732666&r1=732665&r2=732666&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml Thu Jan  8 
01:54:37 2009
@@ -79,22 +79,6 @@
         <field name="actualStartDate"><date-time type="date"/></field>
         <field name="add"><submit/></field>
     </form>
-
-    <form name="preferences" type="single" target="updatePreferences" 
default-map-name="preferences.userPrefMap">
-        <field name="userPrefGroupTypeId"><hidden value="MyPortal"/></field>
-        <field name="myCommunications"><check/></field>
-        <field name="otherCommunications"><check/></field>
-        <field name="myCompanyComms"><check/></field>
-        <field name="myTasks"><check/></field>
-        <field name="myTimesheet"><check/></field>
-        <field name="updateButton"><submit/></field>
-    </form>
-    
-    <form name="custPreferences" type="single" target="updateCustPreferences" 
default-map-name="preferences.userPrefMap">
-        <field name="userPrefGroupTypeId"><hidden value="MyPortal"/></field>
-        <field name="sendCustRequestEmail" 
title="${uiLabelMap.SendMailEveryCust}"><check/></field>
-        <field name="updateButton"><submit/></field>
-    </form>
     
     <form name="ListPartyCommEvents" extends="ListCommEvents" 
extends-resource="component://party/webapp/partymgr/communication/CommForms.xml"
 type="list">
         <row-actions>


Reply via email to