Difference between revisions of "Privileged Module Configuration"

From ADF Docs
Jump to: navigation, search
(Created page with "To allow the scripts that use the ADF's CE Record API (or CommonSpot's Record Set API) to add and/or update data by users that have limited or anonymous (read-only) access, yo...")
 
Line 1: Line 1:
To allow the scripts that use the ADF's CE Record API (or CommonSpot's Record Set API) to add and/or update data by users that have limited or anonymous (read-only) access, you will need to configure the script to be a CommonSpot "Privileged Module".
+
==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 You Code ===
 +
In your script that makes the call the ADF’s ceRecordAPI add a '''Request.User.enableApprovedPrivileges(Request);''' line before the call. And 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>

Revision as of 21:38, 5 February 2025

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 You Code

In your script that makes the call the ADF’s ceRecordAPI add a Request.User.enableApprovedPrivileges(Request); line before the call. And 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>