The following REST call displays a list of all the defined policies:
$ curl --header "X-OpenIDM-Username: openidm-admin" --header "X-OpenIDM-Password: openidm-admin" --request GET "http://localhost:8080/openidm/policy"
The policy objects are returned in JSON format, with one object for each defined policy ID, for example:
{
"resources": [
{
"resource": "managed/user/*",
"properties": [
{
"policies": [
{
"policyId": "required",
"policyFunction": "function required(fullObject, value, params, propName) {
if (value === undefined) {
return [{"policyRequirement":"REQUIRED"}];
}
return [];
}",
"policyRequirements": [
"REQUIRED"
]
},
...To display the policies that apply to a specific component, include the component name in the URL. For example, the following REST call displays the policies that apply to managed users.
$ curl --header "X-OpenIDM-Username: openidm-admin" --header "X-OpenIDM-Password: openidm-admin" --request GET "http://localhost:8080/openidm/policy/managed/user/*"
{
"resource": "managed/user/*",
"properties": [
{
"policies": [
{
"policyId": "required",
"policyFunction": "
\nfunction required(fullObject, value, params, propName) {
\n if (value === undefined) {
\n return [{\"policyRequirement\":\"REQUIRED\"}];
\n }
\n return [];
\n}
\n",
"policyRequirements": [
"REQUIRED"
]
},
{
"policyId": "not-empty",
"policyFunction": "
\nfunction notEmpty(fullObject, value, params, property) {
\n if (typeof (value) !== \"string\" || !value.length) {
\n return [{\"policyRequirement\":\"REQUIRED\"}];
\n } else {
\n return [];
\n }
\n}
\n",
"policyRequirements": [
"REQUIRED"
]
},
{
"policyId": "unique",
"policyRequirements": [
"UNIQUE"
]
},
...
}
