diff --git a/framework/example/config/ExampleUiLabels.xml b/framework/example/config/ExampleUiLabels.xml index e804c6f44e..900d60bbff 100644 --- a/framework/example/config/ExampleUiLabels.xml +++ b/framework/example/config/ExampleUiLabels.xml @@ -466,13 +466,13 @@ DA FARE - You do not have permission to view this page. ("EXAMPLE_VIEW" or "EXAMPLE_ADMIN" needed) - Vous n'avez pas l'autorisation de voir cette page ("EXAMPLE_VIEW" ou "EXAMPLE_ADMIN" nécessaire) - Tu non sei autorizzare a vedere questa pagina. (Permesso "EXAMPLE_VIEW" o "EXAMPLE_ADMIN" necessario) - Nu esti autorizat sa vezi aceasta pagina. (Este necesar Permisul "EXAMPLE_VIEW" sau "EXAMPLE_ADMIN") - У вас нет прав для просмотра этой страницы. (необходимы права "EXAMPLE_VIEW" или "EXAMPLE_ADMIN") - คุณไม่ได้รับอนุญาตให้เข้าดูหน้านี้ได้ (หน้า "EXAMPLE_VIEW" หรือ "EXAMPLE_ADMIN" ที่ต้องการ) - 你没有浏览这个页面的权限。(需要"EXAMPLE_VIEW"或"EXAMPLE_ADMIN") + You do not have permission to view this page. ("access:example" needed) + Vous n'avez pas l'autorisation de voir cette page ("access:example" nécessaire) + Tu non sei autorizzare a vedere questa pagina. (Permesso "access:example" necessario) + Nu esti autorizat sa vezi aceasta pagina. (Este necesar Permisul "access:example") + У вас нет прав для просмотра этой страницы. (необходимы права "access:example") + คุณไม่ได้รับอนุญาตให้เข้าดูหน้านี้ได้ (หน้า "access:example" ที่ต้องการ) + 你没有浏览这个页面的权限。(需要"access:example") Welcome to the Example application! diff --git a/framework/example/data/ExampleSecurityData.xml b/framework/example/data/ExampleSecurityData.xml index 93b9fade56..a2d7f2c97a 100644 --- a/framework/example/data/ExampleSecurityData.xml +++ b/framework/example/data/ExampleSecurityData.xml @@ -19,16 +19,30 @@ under the License. --> - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/example/entitydef/entitymodel.xml b/framework/example/entitydef/entitymodel.xml index 6e6e02eeff..7eee87a92e 100644 --- a/framework/example/entitydef/entitymodel.xml +++ b/framework/example/entitydef/entitymodel.xml @@ -55,6 +55,7 @@ under the License. + @@ -62,6 +63,9 @@ under the License. + + + diff --git a/framework/example/ofbiz-component.xml b/framework/example/ofbiz-component.xml index 601f762e6e..2f7e445adb 100644 --- a/framework/example/ofbiz-component.xml +++ b/framework/example/ofbiz-component.xml @@ -54,6 +54,6 @@ under the License. menu-name="secondary" server="default-server" location="webapp/example" - base-permission="OFBTOOLS,EXAMPLE" + base-permission="access:example" mount-point="/example"/> diff --git a/framework/example/security/CreateExample.groovy b/framework/example/security/CreateExample.groovy new file mode 100644 index 0000000000..0b3afa6e81 --- /dev/null +++ b/framework/example/security/CreateExample.groovy @@ -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 diff --git a/framework/example/security/UpdateExample.groovy b/framework/example/security/UpdateExample.groovy new file mode 100644 index 0000000000..f29def86e2 --- /dev/null +++ b/framework/example/security/UpdateExample.groovy @@ -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; diff --git a/framework/example/servicedef/services.xml b/framework/example/servicedef/services.xml index b9be4eab48..8b5bd195e6 100644 --- a/framework/example/servicedef/services.xml +++ b/framework/example/servicedef/services.xml @@ -27,29 +27,37 @@ under the License. Create a Example - + + + - + Update a Example - + + + Delete a Example - + + + Create a ExampleStatus - + + + @@ -58,7 +66,9 @@ under the License. Create a ExampleItem - + + + @@ -66,60 +76,78 @@ under the License. Update a ExampleItem - + + + Delete a ExampleItem - + + + Create a ExampleFeature - + + + Update a ExampleFeature - + + + Delete a ExampleFeature - + + + Create a ExampleFeatureAppl - + + + Update a ExampleFeatureAppl - + + + Delete a ExampleFeatureAppl - + + + + - + @@ -82,9 +82,9 @@ under the License.
- + - +
@@ -135,7 +135,7 @@ under the License.
- + @@ -148,7 +148,7 @@ under the License.
- +
diff --git a/framework/example/widget/example/ExampleAjaxScreens.xml b/framework/example/widget/example/ExampleAjaxScreens.xml index 46b16383b1..7264e30e78 100644 --- a/framework/example/widget/example/ExampleAjaxScreens.xml +++ b/framework/example/widget/example/ExampleAjaxScreens.xml @@ -34,7 +34,7 @@ under the License.
- + @@ -68,7 +68,7 @@ under the License.
- + @@ -84,7 +84,7 @@ under the License.
- + diff --git a/framework/example/widget/example/ExampleFeatureScreens.xml b/framework/example/widget/example/ExampleFeatureScreens.xml index b0033ec396..3e21195a19 100644 --- a/framework/example/widget/example/ExampleFeatureScreens.xml +++ b/framework/example/widget/example/ExampleFeatureScreens.xml @@ -34,7 +34,7 @@ under the License.
- + @@ -98,7 +98,7 @@ under the License.
- + diff --git a/framework/example/widget/example/ExampleForms.xml b/framework/example/widget/example/ExampleForms.xml index c375a5df9f..b63e0999ff 100644 --- a/framework/example/widget/example/ExampleForms.xml +++ b/framework/example/widget/example/ExampleForms.xml @@ -142,6 +142,8 @@ under the License. + + diff --git a/framework/example/widget/example/ExampleScreens.xml b/framework/example/widget/example/ExampleScreens.xml index 129b656c35..d2d2d1ed92 100644 --- a/framework/example/widget/example/ExampleScreens.xml +++ b/framework/example/widget/example/ExampleScreens.xml @@ -34,7 +34,7 @@ under the License.
- + diff --git a/framework/example/widget/example/FormWidgetExampleScreens.xml b/framework/example/widget/example/FormWidgetExampleScreens.xml index 5aafa9c3fb..06a50030ae 100644 --- a/framework/example/widget/example/FormWidgetExampleScreens.xml +++ b/framework/example/widget/example/FormWidgetExampleScreens.xml @@ -31,7 +31,7 @@ under the License.
- +