Converted Example component to security-aware artifacts.

The Find Example screen search results aren't working, and I'm not sure why. Reverting to the old-style security doesn't fix it. I think it is time to create a new branch and get this synchronized with the trunk again.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/branches/executioncontext20090812@894729 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/applications/securityext/data/UserDemoData.xml b/applications/securityext/data/UserDemoData.xml
index 043264d..fb991e1 100644
--- a/applications/securityext/data/UserDemoData.xml
+++ b/applications/securityext/data/UserDemoData.xml
@@ -96,4 +96,5 @@
     <UserToUserGroupRel userLoginId="ltdadmin1" groupId="OFBIZ_USERS"/>
     <UserToUserGroupRel userLoginId="bizadmin" groupId="OFBIZ_USERS"/>
 
+    <UserToArtifactPermRel userLoginId="admin" artifactPath="ofbiz" permissionValue="admin=true"/>
 </entity-engine-xml>
diff --git a/framework/example/data/ExampleSecurityData.xml b/framework/example/data/ExampleSecurityData.xml
index 52fc431..9a1a56f 100644
--- a/framework/example/data/ExampleSecurityData.xml
+++ b/framework/example/data/ExampleSecurityData.xml
@@ -48,7 +48,7 @@
          is converted over to the new security design, the corresponding admin
          permission should be removed. -->
 
-    <UserGrpToArtifactPermRel groupId="OFBIZ_USERS" artifactPath="ofbiz/example" permissionValue="admin=true"/>
+<!--     <UserGrpToArtifactPermRel groupId="OFBIZ_USERS" artifactPath="ofbiz/example" permissionValue="admin=true"/> -->
     <UserGrpToArtifactPermRel groupId="OFBIZ_USERS" artifactPath="ofbiz/exampleext" permissionValue="admin=true"/>
 
 </entity-engine-xml>
diff --git a/framework/example/servicedef/services.xml b/framework/example/servicedef/services.xml
index 4a5d485..6e57e30 100644
--- a/framework/example/servicedef/services.xml
+++ b/framework/example/servicedef/services.xml
@@ -27,7 +27,7 @@
     <!-- Example & Related Services -->
     <service name="createExample" default-entity-name="Example" engine="entity-auto" invoke="create" auth="true">
         <description>Create a Example</description>
-        <permission-service service-name="exampleGenericPermission" main-action="CREATE"/>
+<!--         <permission-service service-name="exampleGenericPermission" main-action="CREATE"/> -->
         <auto-attributes include="pk" mode="OUT" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <override name="exampleTypeId" optional="false"/>
@@ -36,20 +36,20 @@
     </service>
     <service name="updateExample" default-entity-name="Example" engine="entity-auto" invoke="update" auth="true">
         <description>Update a Example</description>
-        <permission-service service-name="exampleGenericPermission" main-action="UPDATE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="UPDATE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <attribute name="oldStatusId" type="String" mode="OUT" optional="false"/>
     </service>
     <service name="deleteExample" default-entity-name="Example" engine="entity-auto" invoke="delete" auth="true">
         <description>Delete a Example</description>
-        <permission-service service-name="exampleGenericPermission" main-action="DELETE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="DELETE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
     <service name="createExampleStatus" default-entity-name="ExampleStatus" engine="simple"
             location="component://example/script/org/ofbiz/example/example/ExampleServices.xml" invoke="createExampleStatus" auth="true">
         <description>Create a ExampleStatus</description>
-        <permission-service service-name="exampleGenericPermission" main-action="CREATE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="CREATE"/> -->
         <auto-attributes include="all" mode="IN" optional="false">
             <exclude field-name="statusDate"/>
             <exclude field-name="statusEndDate"/>
@@ -58,7 +58,7 @@
 
     <service name="createExampleItem" default-entity-name="ExampleItem" engine="entity-auto" invoke="create" auth="true">
         <description>Create a ExampleItem</description>
-        <permission-service service-name="exampleGenericPermission" main-action="CREATE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="CREATE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <override name="exampleItemSeqId" mode="OUT"/> <!-- make this OUT rather than IN, we will automatically generate the next sub-sequence ID -->
@@ -66,52 +66,52 @@
     </service>
     <service name="updateExampleItem" default-entity-name="ExampleItem" engine="entity-auto" invoke="update" auth="true">
         <description>Update a ExampleItem</description>
-        <permission-service service-name="exampleGenericPermission" main-action="UPDATE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="UPDATE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
     <service name="deleteExampleItem" default-entity-name="ExampleItem" engine="entity-auto" invoke="delete" auth="true">
         <description>Delete a ExampleItem</description>
-        <permission-service service-name="exampleGenericPermission" main-action="DELETE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="DELETE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
 
     <!-- ExampleFeature Services -->
     <service name="createExampleFeature" default-entity-name="ExampleFeature" engine="entity-auto" invoke="create" auth="true">
         <description>Create a ExampleFeature</description>
-        <permission-service service-name="exampleGenericPermission" main-action="CREATE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="CREATE"/> -->
         <auto-attributes include="pk" mode="OUT" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <override name="description" optional="false"/>
     </service>
     <service name="updateExampleFeature" default-entity-name="ExampleFeature" engine="entity-auto" invoke="update" auth="true">
         <description>Update a ExampleFeature</description>
-        <permission-service service-name="exampleGenericPermission" main-action="UPDATE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="UPDATE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
     <service name="deleteExampleFeature" default-entity-name="ExampleFeature" engine="entity-auto" invoke="delete" auth="true">
         <description>Delete a ExampleFeature</description>
-        <permission-service service-name="exampleGenericPermission" main-action="DELETE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="DELETE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
 
     <service name="createExampleFeatureAppl" default-entity-name="ExampleFeatureAppl" engine="entity-auto" invoke="create" auth="true">
         <description>Create a ExampleFeatureAppl</description>
-        <permission-service service-name="exampleGenericPermission" main-action="CREATE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="CREATE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <override name="fromDate" optional="true"/>
     </service>
     <service name="updateExampleFeatureAppl" default-entity-name="ExampleFeatureAppl" engine="entity-auto" invoke="update" auth="true">
         <description>Update a ExampleFeatureAppl</description>
-        <permission-service service-name="exampleGenericPermission" main-action="UPDATE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="UPDATE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
     <service name="deleteExampleFeatureAppl" default-entity-name="ExampleFeatureAppl" engine="entity-auto" invoke="delete" auth="true">
         <description>Delete a ExampleFeatureAppl</description>
-        <permission-service service-name="exampleGenericPermission" main-action="DELETE"/>
+<!--        <permission-service service-name="exampleGenericPermission" main-action="DELETE"/> -->
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
 
diff --git a/framework/example/widget/example/CommonScreens.xml b/framework/example/widget/example/CommonScreens.xml
index e7b7d91..a4764b7 100644
--- a/framework/example/widget/example/CommonScreens.xml
+++ b/framework/example/widget/example/CommonScreens.xml
@@ -70,10 +70,7 @@
                     <decorator-section name="pre-body">
                         <section>
                             <condition>
-                                <and>
-                                    <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-                                    <not><if-empty field="example"/></not>
-                                </and>
+                                <not><if-empty field="example"/></not>
                             </condition>
                             <widgets>
                                 <include-menu name="EditExample" location="component://example/widget/example/ExampleMenus.xml"/>
@@ -82,10 +79,6 @@
                     </decorator-section>
                     <decorator-section name="body">
                         <section>
-                            <!-- do check for EXAMPLE, _VIEW permission -->
-                            <condition>
-                                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-                            </condition>
                             <widgets>
                                 <section>
                                     <condition>
@@ -112,9 +105,6 @@
                                 </section>
                                 <decorator-section-include name="body"/>
                             </widgets>
-                            <fail-widgets>
-                                <label style="h3">${uiLabelMap.ExampleViewPermissionError}</label>
-                            </fail-widgets>
                         </section>
                     </decorator-section>
                 </decorator-screen>
@@ -134,10 +124,7 @@
                     <decorator-section name="pre-body">
                         <section>
                             <condition>
-                                <and>
-                                    <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-                                    <not><if-empty field="exampleFeature"/></not>
-                                </and>
+                                <not><if-empty field="exampleFeature"/></not>
                             </condition>
                             <widgets>
                                 <include-menu name="EditExampleFeature" location="component://example/widget/example/ExampleMenus.xml"/>
@@ -146,10 +133,6 @@
                     </decorator-section>
                     <decorator-section name="body">
                         <section>
-                            <!-- do check for EXAMPLE, _VIEW permission -->
-                            <condition>
-                                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-                            </condition>
                             <widgets>
                                 <section>
                                     <condition>
@@ -169,9 +152,6 @@
                                 </section>
                                 <decorator-section-include name="body"/>
                             </widgets>
-                            <fail-widgets>
-                                <label style="h3">${uiLabelMap.ExampleViewPermissionError}</label>
-                            </fail-widgets>
                         </section>
                     </decorator-section>
                 </decorator-screen>
diff --git a/framework/example/widget/example/ExampleAjaxScreens.xml b/framework/example/widget/example/ExampleAjaxScreens.xml
index 46b1638..825811d 100644
--- a/framework/example/widget/example/ExampleAjaxScreens.xml
+++ b/framework/example/widget/example/ExampleAjaxScreens.xml
@@ -33,9 +33,6 @@
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                         <section>
-                            <condition>
-                                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-                            </condition>
                             <widgets>
                                 <container style="h1"><label>${uiLabelMap[titleProperty]}</label></container>
                                 <section>
@@ -55,9 +52,6 @@
                                     <include-screen name="CreateExampleFormOnly"/>
                                 </container>
                             </widgets>
-                            <fail-widgets>
-                                <label style="h3">${uiLabelMap.ExampleViewPermissionError}</label>
-                            </fail-widgets>
                         </section>
                     </decorator-section>
                 </decorator-screen>
@@ -67,9 +61,6 @@
 
     <screen name="ListExampleFormOnly">
         <section>
-            <condition>
-                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-            </condition>
             <actions>
                 <!-- NOTE: these are needed because this may be run as a top level screen and would have no decorator -->
                 <property-map resource="ExampleUiLabels" map-name="uiLabelMap" global="true"/>
@@ -83,9 +74,6 @@
 
     <screen name="CreateExampleFormOnly">
         <section>
-            <condition>
-                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-            </condition>
             <actions>
                 <!-- these are only needed so that when bsh evaluates use-when attributes these will exist and not cause an error -->
                 <property-map resource="ExampleUiLabels" map-name="uiLabelMap" global="true"/>
diff --git a/framework/example/widget/example/ExampleFeatureScreens.xml b/framework/example/widget/example/ExampleFeatureScreens.xml
index b0033ec..2d64ecb 100644
--- a/framework/example/widget/example/ExampleFeatureScreens.xml
+++ b/framework/example/widget/example/ExampleFeatureScreens.xml
@@ -33,9 +33,6 @@
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                         <section>
-                            <condition>
-                                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-                            </condition>
                             <widgets>
                                 <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
                                     <decorator-section name="menu-bar">
@@ -49,9 +46,6 @@
                                     </decorator-section>
                                 </decorator-screen>
                             </widgets>
-                            <fail-widgets>
-                                <label style="h3">${uiLabelMap.ExampleViewPermissionError}</label>
-                            </fail-widgets>
                         </section>
                     </decorator-section>
                 </decorator-screen>
@@ -97,9 +91,6 @@
 
     <screen name="LookupExampleFeature">
         <section>
-            <condition>
-                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-            </condition>
             <actions>
                 <property-map resource="ExampleUiLabels" map-name="uiLabelMap" global="true"/>
                 <set field="title" value="${uiLabelMap.PageTitleLookupExampleFeature}"/>
@@ -107,7 +98,6 @@
                 <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="10"/>
             </actions>
-
             <widgets>
                 <decorator-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml">
                     <decorator-section name="search-options">
diff --git a/framework/example/widget/example/ExampleScreens.xml b/framework/example/widget/example/ExampleScreens.xml
index 019cd85..c66b6b0 100644
--- a/framework/example/widget/example/ExampleScreens.xml
+++ b/framework/example/widget/example/ExampleScreens.xml
@@ -33,9 +33,6 @@
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                         <section>
-                            <condition>
-                                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-                            </condition>
                             <widgets>
                                 <!--  Uncomment this section to see the ExecutionContext in action
                                 <container style="button-bar"><label text="Execution path for this screen: ${executionContext}"/></container>
@@ -53,9 +50,6 @@
                                     </decorator-section>
                                 </decorator-screen>
                             </widgets>
-                            <fail-widgets>
-                                <label style="h3">${uiLabelMap.ExampleViewPermissionError}</label>
-                            </fail-widgets>
                         </section>
                     </decorator-section>
                 </decorator-screen>
diff --git a/framework/example/widget/example/FormWidgetExampleScreens.xml b/framework/example/widget/example/FormWidgetExampleScreens.xml
index 5aafa9c..07257df 100644
--- a/framework/example/widget/example/FormWidgetExampleScreens.xml
+++ b/framework/example/widget/example/FormWidgetExampleScreens.xml
@@ -30,9 +30,6 @@
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                         <section>
-                            <condition>
-                                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
-                            </condition>
                             <widgets>
                                 <container style="h1"><label>${uiLabelMap.PageTitleFormWidgetExamples}</label></container>
                                 <container style="screenlet-body">
@@ -70,9 +67,6 @@
                                     <include-form name="FOPFontsExampleForm" location="component://example/widget/example/FormWidgetExampleForms.xml"/>
                                 </container>
                             </widgets>
-                            <fail-widgets>
-                                <label style="h3">${uiLabelMap.ExampleViewPermissionError}</label>
-                            </fail-widgets>
                         </section>
                     </decorator-section>
                 </decorator-screen>