diff --git a/framework/example/config/ExampleUiLabels.properties b/framework/example/config/ExampleUiLabels.properties
index 781a31b342..24fda517b8 100644
--- a/framework/example/config/ExampleUiLabels.properties
+++ b/framework/example/config/ExampleUiLabels.properties
@@ -35,7 +35,7 @@ ExampleNewExample=New Example
ExampleNewExampleFeature=New Example Feature
ExampleErrorNoExampleStatusValidChange=Error\: status change from [${lookedUpValue.statusId}] to [${parameters.statusId}] is not allowed.
-ExamplePermissionError=Security Error\: to run ${methodShortDescription} you must have the EXAMPLE_${mainAction} or EXAMPLE_ADMIN permission
+ExamplePermissionError=Security Error\: to run ${resourceDescription} you must have the EXAMPLE_${mainAction} or EXAMPLE_ADMIN permission
ExampleViewPermissionError=You do not have permission to view this page. ("EXAMPLE_VIEW" or "EXAMPLE_ADMIN" needed)
ExampleWelcome=Welcome to the Example application!
diff --git a/framework/example/script/org/ofbiz/example/ExamplePermissionServices.xml b/framework/example/script/org/ofbiz/example/ExamplePermissionServices.xml
index 3900508e28..df00548d09 100644
--- a/framework/example/script/org/ofbiz/example/ExamplePermissionServices.xml
+++ b/framework/example/script/org/ofbiz/example/ExamplePermissionServices.xml
@@ -1,18 +1,19 @@
+
+Copyright 2001-2006 The Apache Software Foundation
+
+Licensed 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.
+-->
@@ -34,4 +35,4 @@
-
\ No newline at end of file
+
diff --git a/framework/service/dtd/services.xsd b/framework/service/dtd/services.xsd
index 946730353e..a0fde40be2 100644
--- a/framework/service/dtd/services.xsd
+++ b/framework/service/dtd/services.xsd
@@ -116,6 +116,9 @@ under the License.
+
+ This will be used in error messages, et cetera. If not specified will default to a service name.
+
diff --git a/framework/service/servicedef/services.xml b/framework/service/servicedef/services.xml
index deae1b2130..f15c4e57c5 100644
--- a/framework/service/servicedef/services.xml
+++ b/framework/service/servicedef/services.xml
@@ -54,6 +54,9 @@ under the License.
Interface to describe base parameters for Permission Services
+
+
+
diff --git a/framework/service/src/org/ofbiz/service/ModelService.java b/framework/service/src/org/ofbiz/service/ModelService.java
index ed8083e769..940f3a6237 100644
--- a/framework/service/src/org/ofbiz/service/ModelService.java
+++ b/framework/service/src/org/ofbiz/service/ModelService.java
@@ -126,6 +126,9 @@ public class ModelService implements Serializable {
/** Permission service main-action */
public String permissionMainAction;
+ /** Permission service resource-description */
+ public String permissionResourceDescription;
+
/** Set of services this service implements */
public Set implServices = new ListOrderedSet();
@@ -757,8 +760,10 @@ public class ModelService implements Serializable {
*/
public Map evalPermission(DispatchContext dctx, Map context) {
if (UtilValidate.isNotEmpty(this.permissionServiceName)) {
+ ModelService thisService;
ModelService permission;
try {
+ thisService = dctx.getModelService(dctx.getName());
permission = dctx.getModelService(this.permissionServiceName);
} catch (GenericServiceException e) {
Map result = ServiceUtil.returnSuccess();
@@ -771,6 +776,11 @@ public class ModelService implements Serializable {
if (UtilValidate.isNotEmpty(this.permissionMainAction)) {
ctx.put("mainAction", this.permissionMainAction);
}
+ if (UtilValidate.isNotEmpty(this.permissionMainAction)) {
+ ctx.put("resourceDescription", this.permissionResourceDescription);
+ } else if (thisService != null) {
+ ctx.put("resourceDescription", thisService.name);
+ }
LocalDispatcher dispatcher = dctx.getDispatcher();
Map resp;
try {
diff --git a/framework/service/src/org/ofbiz/service/ModelServiceReader.java b/framework/service/src/org/ofbiz/service/ModelServiceReader.java
index 8713e9143d..ee9a2c375a 100644
--- a/framework/service/src/org/ofbiz/service/ModelServiceReader.java
+++ b/framework/service/src/org/ofbiz/service/ModelServiceReader.java
@@ -363,6 +363,7 @@ public class ModelServiceReader implements Serializable {
if (e != null) {
model.permissionServiceName = e.getAttribute("service-name");
model.permissionMainAction = e.getAttribute("main-action");
+ model.permissionResourceDescription = e.getAttribute("resource-description");
model.auth = true; // auth is always required when permissions are set
}
}