...
Info |
---|
According to the ECMAScript standard (ECMA-262, 3rd edition), "An ECMAScript program is considered syntactically incorrect if it contains a return statement that is not within a FunctionBody.". Therefore, you must first define a function and then invoke it within your script as show in the example below. Note, as the last statement in the script, the result of the function call will automatically be returned as the value of the script. |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<PolicyRequirementRule xsi:type="basic:Script"> <basic:Script> <![CDATA[ function evaluateRule(filterContext, attributeId, attributeValue) { if (attributeId == null) return true; if (attributeValue == null) return true; return filterContext.getAttributeRequestContext().getAttributes().get("uid").equals("jsmith"); } evaluateRule(filterContext, attributeId, attributeValue); ]]> </basic:Script> </PolicyRequirementRule> |
...