JavaScript API Class: PageSecurity
Provides a structured way to get and set the page security setting. PageSecurity objects are accessed via the security property of any Page object. See the documentation for page.security for more information. Changes made to this object are saved when the save() method is called on the parent page object.
Properties
| Name | Type |
Access |
Description |
| DEFAULT | String |
read |
Constant for use with the setting property. Specifies that security for this page should fall back to the site-level page security setting. |
| PUBLIC_VIEW_PUBLIC_EDIT |
String |
read |
Constant for use with the setting property. Over-rides the site-level page security setting for this page with Public View/Public Edit. |
| PUBLIC_VIEW_REGISTER_EDIT |
String |
read |
Constant for use with the setting property. Over-rides the site-level page security setting for this page with Public View/Register Edit. |
| PUBLIC_VIEW_ADMIN_EDIT |
String |
read |
Constant for use with the setting property. Over-rides the site-level page security setting for this page with Public View/Administrator Edit. |
| REGISTER_VIEW_REGISTER_EDIT |
String |
read |
Constant for use with the setting property. Over-rides the site-level page security setting for this page with Registered View/Registered Edit. |
| REGISTER_VIEW_ADMIN_EDIT |
String |
read |
Constant for use with the setting property. Over-rides the site-level page security setting for this page with Registered View/Administrator Edit. |
| ADMIN_VIEW_ADMIN_EDIT |
String |
read |
Constant for use with the setting property. Over-rides the site-level page security setting for this page with Administrator View/Administrator Edit. |
| POLICY |
String |
read |
Constant for use with the setting property. Over-rides the site-level
page security setting for this page with the policy object set to the policy property of this object. |
| setting |
String |
read/write |
Returns or can be set to one of the constants defined above. If set to POLICY, the policy property can be used to retrieve the policy active for this page. |
| policy | String |
read/write |
Returns or can be set to the policy object that defines the security behavior for this page. If set, the setting property is automatically set to POLICY. |
Examples:
// set the security of a page to over-ride the site setting with Register View/Administrator Edit
var mypage = site.getPageForEdit('MyPage');
mypage.security.setting = mypage.security.REGISTER_VIEW_ADMIN_EDIT;
mypage.save();
// set the security to a new policy
var mypol = site.newPolicy();
mypol.name = 'My New Policy';
mypol.save();
mypage.security.policy = mypol;
mypage.save();