JavaScript API Class: Policy
The Policy class represents a security policy. See Policies for a discussion of how they are used in EditMe. See the Site class for additional policy-related methods. Viewing the Policy settings page in an EditMe site and understanding how that works will be helpful for understanding how this class works.
Properties
| Name | Type | Access |
Description |
| UNDEFINED | Number (0) |
read |
Specifies an undefined permission. Used to allow a Group's permission in a policy to fall back to the permission defined by the registeredPermission setting. This is equivalent to selecting "Default" for a group in EditMe's Policy settings screen. If set to publicPermission or registeredPermission, this value will act like NONE. |
| NONE | Number (0) |
read |
Specifies no permission for either the publicPermission or registeredPermission values. If set to a Group's permission, this value will act like UNDEFINED. |
| VIEW | Number (1) |
read |
Specifies that public users, registered users or group users can view content but not edit it. |
| EDIT | Number (2) |
read |
Specifies that public users, registered users or group users can view and edit content. |
| name |
String |
read/write |
Gets or sets the name of this policy. The name is an arbitrary text label. |
| id |
Number | read |
The system generated ID number for this policy. |
| publicPermission |
Number |
read/write |
The permission value to be applied to non-logged in user for this policy. Possible values are NONE, VIEW and EDIT. |
| registeredPermission | Number |
read/write |
The permission value to be applied to registered users for this policy. Possible values are NONE, VIEW and EDIT. |
Functions
| Name | Return Type |
Description |
| getGroupPermission (Group) |
Number |
Returns the permission value for the given Group as it applies to this policy. Possible values are UNDEFINED, VIEW and EDIT. |
| setGroupPermission (Group, Number) | none | Sets the permission value for the given Group to the specified value. Possible values are UNDEFINED, VIEW and EDIT. Permissions set with this function are not saved until the save() method is called. |
| save() | none |
Saves changes made to this Policy, or creates a new policy if it doesn't exist yet. Use the newPolicy() method of the [Site] class to create a new Policy. |
| destroy() |
none | Permanently deletes the policy. |
Return to Java Script API