Privileged Module Configuration
From ADF Docs
Revision as of 22:01, 5 February 2025 by Gcronkright (talk | contribs) (→Update the Custom Element Security)
Contents
Overview
To allow scripts that use the ADF's CE Record API or the CommonSpot's Custom Data API to add or update data by users with limited or anonymous (read-only) access add a couple of lines of code to your script and register it with Privilege Module rights.
Update Your Code
- In your script that makes the call the ADF’s ceRecordAPI add a Request.User.enableApprovedPrivileges(Request); line before the call.
- Then add a Request.User.disableApprovedPrivileges(); after the add/update call.
<cfscript> // Enable addRecord() function to run for users with lower or anonymous permissions Request.User.enableApprovedPrivileges(Request); result = Application.ADF.gceRecord.addRecord(ceName=ceName,dataValues=dataValues); // Reset the user's permissions Request.User.disableApprovedPrivileges(); </cfscript>
Add a CommonSpot User Group
- Go to your CommonSpot Group Administration
- Create a Group with Add Data and/or Edit Data permissions
- No user or group needs to be added to this Privileged Module group.
Note: The user requesting to add or update data will be added to and then removed from the group after the call is made on the fly.
Update the Custom Element Security
- Go to Site Admin > Elements & Forms > Manage Elements
- When the Manage Element dialog opens, find your Custom Element.
- From the ‘Edit Element Properties’ (pencil icon) drop down, select the ‘Security…’ menu item
- Add the Group you just created in the previous step to the Custom Element Security
- From the next dialog add the appropriate select the ‘Add Data’ and/or ‘Edit Data’ permissions:
- If the user is allowed to:
- add data to this Custom Element, select the ‘Add Data’ permissions.
- update data in this Custom Element, select the ‘Edit Data’ permissions.
- perform both actions 'add' and 'update', then select both ‘Add Data’ and ‘Edit Data’ permissions.
- If the user is allowed to:
- Click Save
- Click Close