Metadata Security element
The goal of the Security element is to set security for each form element.
The Security element can only be used in combination with other fields:
- Metadata Checkbox field
- Metadata Input field
- Metadata Select field
- Metadata Suggestbox field
- Metadata TextArea field
Available child security elements:
| name | Description |
|---|---|
| grantUser | Sets access for a user. |
| grantRole | Sets access for members of a role. |
| revokeUser | Revokes access for a user. |
| revokeRole | Revokes access for members of a role. |
Each of these elements requires a name attribute (Required: Yes): the username (for grantUser/revokeUser) or role name (for grantRole/revokeRole) to grant or revoke access for.
Basic grant example
Section titled “Basic grant example”- Grant access to a field to a specific user: only testUser user is able to access the metadata field named okp:consulting.input1. The defaultAccess property is set to revoke, so no regular user will be able to see this property.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.15//EN" "http://www.openkm.com/dtd/property-groups-3.15.dtd"><property-groups> <property-group label="Consulting" name="okg:consulting"> <input label="Input label" name="okp:consulting.input1" defaultAccess="revoke"> <grantUser name="testUser"/> </input> <separator label="Separator label" name="okp:consulting.separator" /> <input label="Input label" name="okp:consulting.input2" /> </property-group></property-groups>Basic revoke example
Section titled “Basic revoke example”- Revoke access to a field for a specific user: the user testUser does not have access to the metadata field named okp:consulting.input1, while other users who have access to the metadata group still have access to it. The defaultAccess property is not present, so the default policy (“grant”) is used, which means that all users will be able to see the property unless there is a child revokeUser tag to exclude users.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.15//EN" "http://www.openkm.com/dtd/property-groups-3.15.dtd"><property-groups> <property-group label="Consulting" name="okg:consulting"> <input label="Input label" name="okp:consulting.input1"> <revokeUser name="testUser"/> </input> <separator label="Separator label" name="okp:consulting.separator" /> <input label="Input label" name="okp:consulting.input2" /> </property-group></property-groups>