Author: jaz
Date: Thu Apr 30 06:23:18 2009
New Revision: 770084

URL: http://svn.apache.org/viewvc?rev=770084&view=rev
Log:
Refactored Example Application to use new security mechanics - JIRA OFBIZ-2392

Added:
    ofbiz/trunk/framework/example/security/
    ofbiz/trunk/framework/example/security/CreateExample.groovy
    ofbiz/trunk/framework/example/security/UpdateExample.groovy
Modified:
    ofbiz/trunk/framework/example/config/ExampleUiLabels.xml
    ofbiz/trunk/framework/example/data/ExampleSecurityData.xml
    ofbiz/trunk/framework/example/entitydef/entitymodel.xml
    ofbiz/trunk/framework/example/ofbiz-component.xml
    ofbiz/trunk/framework/example/servicedef/services.xml
    ofbiz/trunk/framework/example/widget/example/CommonScreens.xml
    ofbiz/trunk/framework/example/widget/example/ExampleAjaxScreens.xml
    ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml
    ofbiz/trunk/framework/example/widget/example/ExampleForms.xml
    ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml
    ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml

Modified: ofbiz/trunk/framework/example/config/ExampleUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/config/ExampleUiLabels.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/config/ExampleUiLabels.xml (original)
+++ ofbiz/trunk/framework/example/config/ExampleUiLabels.xml Thu Apr 30 
06:23:18 2009
@@ -466,13 +466,13 @@
         <value xml:lang="it">DA FARE</value>
     </property>
     <property key="ExampleViewPermissionError">
-        <value xml:lang="en">You do not have permission to view this page. 
("EXAMPLE_VIEW" or "EXAMPLE_ADMIN" needed)</value>
-        <value xml:lang="fr">Vous n'avez pas l'autorisation de voir cette page 
("EXAMPLE_VIEW" ou "EXAMPLE_ADMIN" nécessaire)</value>
-        <value xml:lang="it">Tu non sei autorizzare a vedere questa pagina. 
(Permesso "EXAMPLE_VIEW" o "EXAMPLE_ADMIN" necessario)</value>
-        <value xml:lang="ro">Nu esti autorizat sa vezi aceasta pagina. (Este 
necesar Permisul "EXAMPLE_VIEW" sau "EXAMPLE_ADMIN")</value>
-        <value xml:lang="ru">У вас нет прав для 
просмотра этой страницы. (необходимы права 
"EXAMPLE_VIEW" или "EXAMPLE_ADMIN")</value>
-        <value 
xml:lang="th">คุณไม่ได้รับอนุญาตให้เข้าดูหน้านี้ได้
 (หน้า "EXAMPLE_VIEW" หรือ "EXAMPLE_ADMIN" 
ที่ต้องการ)</value>
-        <value 
xml:lang="zh">你没有浏览这个页面的权限。(需要"EXAMPLE_VIEW"或"EXAMPLE_ADMIN")</value>
+        <value xml:lang="en">You do not have permission to view this page. 
("access:example" needed)</value>
+        <value xml:lang="fr">Vous n'avez pas l'autorisation de voir cette page 
("access:example" nécessaire)</value>
+        <value xml:lang="it">Tu non sei autorizzare a vedere questa pagina. 
(Permesso "access:example" necessario)</value>
+        <value xml:lang="ro">Nu esti autorizat sa vezi aceasta pagina. (Este 
necesar Permisul "access:example")</value>
+        <value xml:lang="ru">У вас нет прав для 
просмотра этой страницы. (необходимы права 
"access:example")</value>
+        <value 
xml:lang="th">คุณไม่ได้รับอนุญาตให้เข้าดูหน้านี้ได้
 (หน้า "access:example" ที่ต้องการ)</value>
+        <value 
xml:lang="zh">你没有浏览这个页面的权限。(需要"access:example")</value>
     </property>
     <property key="ExampleWelcome">
         <value xml:lang="en">Welcome to the Example application!</value>

Modified: ofbiz/trunk/framework/example/data/ExampleSecurityData.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/data/ExampleSecurityData.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/data/ExampleSecurityData.xml (original)
+++ ofbiz/trunk/framework/example/data/ExampleSecurityData.xml Thu Apr 30 
06:23:18 2009
@@ -19,16 +19,30 @@
 -->
 <entity-engine-xml>
     <!-- Example security -->
-    <SecurityPermission description="View operations in the Example Management 
Screens." permissionId="EXAMPLE_VIEW"/>
-    <SecurityPermission description="Create operations in the Example 
Management Screens." permissionId="EXAMPLE_CREATE"/>
-    <SecurityPermission description="Update operations in the Example 
Management Screens." permissionId="EXAMPLE_UPDATE"/>
-    <SecurityPermission description="Delete operations in the Example 
Management Screens." permissionId="EXAMPLE_DELETE"/>
-    <SecurityPermission description="ALL operations in the Example Management 
Screens." permissionId="EXAMPLE_ADMIN"/>
-    <SecurityGroupPermission groupId="FULLADMIN" permissionId="EXAMPLE_ADMIN"/>
-    <SecurityGroupPermission groupId="FLEXADMIN" 
permissionId="EXAMPLE_CREATE"/>
-    <SecurityGroupPermission groupId="FLEXADMIN" 
permissionId="EXAMPLE_DELETE"/>
-    <SecurityGroupPermission groupId="FLEXADMIN" 
permissionId="EXAMPLE_UPDATE"/>
-    <SecurityGroupPermission groupId="FLEXADMIN" permissionId="EXAMPLE_VIEW"/>
-    <SecurityGroupPermission groupId="VIEWADMIN" permissionId="EXAMPLE_VIEW"/>
-    <SecurityGroupPermission groupId="BIZADMIN" permissionId="EXAMPLE_ADMIN"/>
+    <SecurityPermission description="ACCESS the Example Application" 
permissionId="access:example"/>
+    <SecurityPermission description="CREATE operations in the Example 
Application" permissionId="create:example" 
dynamicAccess="component://example/security/CreateExample.groovy"/>
+    <SecurityPermission description="READ operations in the Example 
Application" permissionId="read:example"/>    
+    <SecurityPermission description="UPDATE operations in the Example 
Application" permissionId="update:example" 
dynamicAccess="component://example/security/UpdateExample.groovy"/>
+    <SecurityPermission description="DELETE operations in the Example 
Application" permissionId="delete:example"/>
+    
+    <SecurityPermission description="CREATE STATUS operations in the Example 
Application" permissionId="create:example:status"/>
+    <SecurityPermission description="READ STATUS operations in the Example 
Application" permissionId="read:example:status"/>    
+    <SecurityPermission description="UPDATE STATUS operations in the Example 
Application" permissionId="update:example:status"/>
+    <SecurityPermission description="DELETE STATUS operations in the Example 
Application" permissionId="delete:example:status"/> 
+    
+    <SecurityPermission description="CREATE ITEM operations in the Example 
Application" permissionId="create:example:item"/>
+    <SecurityPermission description="READ ITEM operations in the Example 
Application" permissionId="read:example:item"/>    
+    <SecurityPermission description="UPDATE ITEM operations in the Example 
Application" permissionId="update:example:item"/>
+    <SecurityPermission description="DELETE ITEM operations in the Example 
Application" permissionId="delete:example:item"/>    
+    
+    <SecurityPermission description="CREATE FEATURE operations in the Example 
Application" permissionId="create:example:feature"/>
+    <SecurityPermission description="READ ITEM operations in the Example 
Application" permissionId="read:example:feature"/>    
+    <SecurityPermission description="UPDATE ITEM operations in the Example 
Application" permissionId="update:example:feature"/>
+    <SecurityPermission description="DELETE ITEM operations in the Example 
Application" permissionId="delete:example:feature"/>    
+                      
+    <SecurityGroupPermission groupId="BIZADMIN" permissionId="access:example"/>
+    <SecurityGroupPermission groupId="BIZADMIN" permissionId="create:example"/>
+    <SecurityGroupPermission groupId="BIZADMIN" permissionId="read:example"/>
+    <SecurityGroupPermission groupId="BIZADMIN" permissionId="update:example"/>
+    <SecurityGroupPermission groupId="BIZADMIN" permissionId="delete:example"/>
 </entity-engine-xml>

Modified: ofbiz/trunk/framework/example/entitydef/entitymodel.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/entitydef/entitymodel.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/framework/example/entitydef/entitymodel.xml Thu Apr 30 06:23:18 
2009
@@ -55,6 +55,7 @@
         <field name="exampleDate" type="date-time"></field>
         <field name="anotherDate" type="date-time"></field>
         <field name="anotherText" type="long-varchar"></field>
+        <field name="createdByUser" type="id-vlong-ne"></field>
         <prim-key field="exampleId"/>
         <relation type="one" fk-name="EXMPL_TYP" rel-entity-name="ExampleType">
             <key-map field-name="exampleTypeId"/>
@@ -62,6 +63,9 @@
         <relation type="one" fk-name="EXMPL_STTS" rel-entity-name="StatusItem">
             <key-map field-name="statusId"/>
         </relation>
+        <relation type="one" fk-name="EXMPL_USER" rel-entity-name="UserLogin">
+            <key-map field-name="createdByUser" rel-field-name="userLoginId"/>
+        </relation>
     </entity>
     <entity entity-name="ExampleItem" package-name="org.ofbiz.example.example" 
title="Example Item Entity" default-resource-name="ExampleEntityLabels">
         <field name="exampleId" type="id-ne"></field>

Modified: ofbiz/trunk/framework/example/ofbiz-component.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/ofbiz-component.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/ofbiz-component.xml (original)
+++ ofbiz/trunk/framework/example/ofbiz-component.xml Thu Apr 30 06:23:18 2009
@@ -54,6 +54,6 @@
         menu-name="secondary"
         server="default-server"
         location="webapp/example"
-        base-permission="OFBTOOLS,EXAMPLE"
+        base-permission="access:example"
         mount-point="/example"/>
 </ofbiz-component>

Added: ofbiz/trunk/framework/example/security/CreateExample.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/security/CreateExample.groovy?rev=770084&view=auto
==============================================================================
--- ofbiz/trunk/framework/example/security/CreateExample.groovy (added)
+++ ofbiz/trunk/framework/example/security/CreateExample.groovy Thu Apr 30 
06:23:18 2009
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+ // this dynamic access grants ANYONE access 
+ return true;
\ No newline at end of file

Added: ofbiz/trunk/framework/example/security/UpdateExample.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/security/UpdateExample.groovy?rev=770084&view=auto
==============================================================================
--- ofbiz/trunk/framework/example/security/UpdateExample.groovy (added)
+++ ofbiz/trunk/framework/example/security/UpdateExample.groovy Thu Apr 30 
06:23:18 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+import org.ofbiz.base.util.Debug;
+
+exampleId = permissionContext.get("exampleId");
+Debug.logInfo("Groovy DA Context : " + permissionContext, "groovy");
+Debug.logInfo("Calling UpdateExample.groovy - " + exampleId, "groovy");
+if (exampleId != null) {
+    example = delegator.findOne("Example", [exampleId : exampleId], true);
+    Debug.logInfo("Example : " + example, "groovy");
+    
+    if (example.createdByUser == null || userId.equals(example.createdByUser)) 
{
+        return true;
+    }
+}
+
+return false;

Modified: ofbiz/trunk/framework/example/servicedef/services.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/servicedef/services.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/example/servicedef/services.xml Thu Apr 30 06:23:18 
2009
@@ -27,29 +27,37 @@
     <!-- 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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="create:example"/>
+        </required-permissions>        
         <auto-attributes include="pk" mode="OUT" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <override name="exampleTypeId" optional="false"/>
         <override name="statusId" optional="false"/>
-        <override name="exampleName" optional="false"/>
+        <override name="exampleName" optional="false"/>        
     </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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="update:example:${exampleId}"/>
+        </required-permissions>
         <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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="delete:example:${exampleId}"/>
+        </required-permissions>
         <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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="update:example:status:${exampleId}"/>
+        </required-permissions>
         <auto-attributes include="all" mode="IN" optional="false">
             <exclude field-name="statusDate"/>
             <exclude field-name="statusEndDate"/>
@@ -58,7 +66,9 @@
 
     <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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="create:example:item:${exampleId}"/>
+        </required-permissions>
         <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,60 +76,78 @@
     </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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="update:example:item:${exampleId}"/>
+        </required-permissions>
         <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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="delete:example:item:${exampleId}"/>
+        </required-permissions>
         <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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="create:example:feature"/>
+        </required-permissions>
         <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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="update:example:feature"/>
+        </required-permissions>
         <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"/>
+        <required-permissions join-type="AND">
+            <check-permission permission="delete:example:feature"/>
+        </required-permissions>
         <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"/>
+        <required-permissions join-type="AND">
+            <check-permission 
permission="create:example:feature:${exampleFeatureId}"/>
+        </required-permissions>
         <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"/>
+        <required-permissions join-type="AND">
+            <check-permission 
permission="update:example:feature:${exampleFeatureId}"/>
+        </required-permissions>
         <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"/>
+        <required-permissions join-type="AND">
+            <check-permission 
permission="delete:example:feature:${exampleFeatureId}"/>
+        </required-permissions>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
 
     <!-- Permission Services -->
+    <!--  @deprecated
     <service name="exampleGenericPermission" engine="simple"
              
location="component://example/script/org/ofbiz/example/ExamplePermissionServices.xml"
 invoke="exampleGenericPermission">
         <implements service="permissionInterface"/>
     </service>
+    -->
 
     <!-- Example ServiceTest Service -->
     <service name="testCreateExampleService" engine="simple"

Modified: ofbiz/trunk/framework/example/widget/example/CommonScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/CommonScreens.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/CommonScreens.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/CommonScreens.xml Thu Apr 30 
06:23:18 2009
@@ -71,7 +71,7 @@
                         <section>
                             <condition>
                                 <and>
-                                    <if-has-permission permission="EXAMPLE" 
action="_VIEW"/>
+                                    <if-has-permission 
permission="access:example"/>
                                     <not><if-empty field="example"/></not>
                                 </and>
                             </condition>
@@ -82,9 +82,9 @@
                     </decorator-section>
                     <decorator-section name="body">
                         <section>
-                            <!-- do check for EXAMPLE, _VIEW permission -->
+                            <!-- do check for access:example permission -->
                             <condition>
-                                <if-has-permission permission="EXAMPLE" 
action="_VIEW"/>
+                                <if-has-permission 
permission="access:example"/>
                             </condition>
                             <widgets>
                                 <section>
@@ -135,7 +135,7 @@
                         <section>
                             <condition>
                                 <and>
-                                    <if-has-permission permission="EXAMPLE" 
action="_VIEW"/>
+                                    <if-has-permission 
permission="access:example"/>
                                     <not><if-empty 
field="exampleFeature"/></not>
                                 </and>
                             </condition>
@@ -148,7 +148,7 @@
                         <section>
                             <!-- do check for EXAMPLE, _VIEW permission -->
                             <condition>
-                                <if-has-permission permission="EXAMPLE" 
action="_VIEW"/>
+                                <if-has-permission 
permission="access:example"/>
                             </condition>
                             <widgets>
                                 <section>

Modified: ofbiz/trunk/framework/example/widget/example/ExampleAjaxScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleAjaxScreens.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleAjaxScreens.xml 
(original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleAjaxScreens.xml Thu Apr 
30 06:23:18 2009
@@ -34,7 +34,7 @@
                     <decorator-section name="body">
                         <section>
                             <condition>
-                                <if-has-permission permission="EXAMPLE" 
action="_VIEW"/>
+                                <if-has-permission 
permission="access:example"/>
                             </condition>
                             <widgets>
                                 <container 
style="h1"><label>${uiLabelMap[titleProperty]}</label></container>
@@ -68,7 +68,7 @@
     <screen name="ListExampleFormOnly">
         <section>
             <condition>
-                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
+                <if-has-permission permission="access:example"/>
             </condition>
             <actions>
                 <!-- NOTE: these are needed because this may be run as a top 
level screen and would have no decorator -->
@@ -84,7 +84,7 @@
     <screen name="CreateExampleFormOnly">
         <section>
             <condition>
-                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
+                <if-has-permission permission="access:example"/>
             </condition>
             <actions>
                 <!-- these are only needed so that when bsh evaluates use-when 
attributes these will exist and not cause an error -->

Modified: ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml 
(original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml Thu 
Apr 30 06:23:18 2009
@@ -34,7 +34,7 @@
                     <decorator-section name="body">
                         <section>
                             <condition>
-                                <if-has-permission permission="EXAMPLE" 
action="_VIEW"/>
+                                <if-has-permission 
permission="access:example"/>
                             </condition>
                             <widgets>
                                 <decorator-screen name="FindScreenDecorator" 
location="component://common/widget/CommonScreens.xml">
@@ -98,7 +98,7 @@
     <screen name="LookupExampleFeature">
         <section>
             <condition>
-                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
+                <if-has-permission permission="access:example"/>
             </condition>
             <actions>
                 <property-map resource="ExampleUiLabels" map-name="uiLabelMap" 
global="true"/>

Modified: ofbiz/trunk/framework/example/widget/example/ExampleForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleForms.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleForms.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleForms.xml Thu Apr 30 
06:23:18 2009
@@ -142,6 +142,8 @@
         <field name="displayAnotherText" 
use-when="example!=null&amp;&amp;example.get(&quot;anotherText&quot;)!=null">
             <display description="${example.anotherText}"/>
         </field>
+        <field name="createdByUser" use-when="example==null"><hidden 
value="${userLogin.userLoginId}"/></field>
+        <field name="createdByUser" use-when="example!=null"><hidden/></field>
         <field name="submitButton" use-when="example==null" 
title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
         <field name="submitButton" use-when="example!=null" 
title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
     </form>

Modified: ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml Thu Apr 30 
06:23:18 2009
@@ -34,7 +34,7 @@
                     <decorator-section name="body">
                         <section>
                             <condition>
-                                <if-has-permission permission="EXAMPLE" 
action="_VIEW"/>
+                                <if-has-permission 
permission="access:example"/>
                             </condition>
                             <widgets>
                                 <decorator-screen name="FindScreenDecorator" 
location="component://common/widget/CommonScreens.xml">

Modified: 
ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml?rev=770084&r1=770083&r2=770084&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml 
(original)
+++ ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml 
Thu Apr 30 06:23:18 2009
@@ -31,7 +31,7 @@
                     <decorator-section name="body">
                         <section>
                             <condition>
-                                <if-has-permission permission="EXAMPLE" 
action="_VIEW"/>
+                                <if-has-permission 
permission="access:example"/>
                             </condition>
                             <widgets>
                                 <container 
style="h1"><label>${uiLabelMap.PageTitleFormWidgetExamples}</label></container>


Reply via email to