variables.siteVars = StructNew();
variables.userID = ""; // Profile user id
variables.roles = StructNew(); // Store the users profile role available
variables.elementData = StructNew(); // Store the CE Data
variables.elementData.values = StructNew();
variables.elementData.pageID = 0; // Store the users profile element pages exist
variables.needsValidation = ""; // List of fields with additional validation
var elementData = StructNew();
if ( LEN(arguments.userID) GT 0 )
{
// Set the user ID
setProfileUserID(arguments.userID);
// Set the site variables
setSiteVars();
if ( ListLen(StructKeyList(getSiteVars())) )
{
// Set Element Data struct
setElementData(variables.siteVars.CE_NAME, variables.siteVars.CE_ID_FIELD, variables.userID, variables.needsValidation);
// Set the users roles
setRoles(variables.userID, variables.siteVars, variables.elementData.values);
}
else
{
// TODO - Site config file was not found
}
}
else
{
// TODO - No userid passed in
}
return this;
variables.elementData = application.ptProfile.profileDAO.getDataValues(arguments.elementName, arguments.fieldName, arguments.fieldValue, arguments.validationFields);
var i = 1;
var roleTags = StructKeyList(arguments.siteVarStruct.roles);
var keyName = "";
// loop over the role struct
for (i=1; i LTE ListLen(roleTags); i=i+1) {
keyName = ListGetAt(roleTags,i);
StructInsert(variables.roles, keyName, false, true);
// Clear the struct
variables.roles[keyName] = StructNew();
// set the value for the role
variables.roles[keyName].permission = application.ptProfile.profileRoles.setRolePermission(keyName, arguments.datavalues);
// Verify that we have permission to the role
if ( variables.roles[keyName].permission EQ true )
{
// Set the role page ID for the user
variables.roles[keyName].pageID = application.ptProfile.profileDAO.verifyProfilePageExists(arguments.siteVarStruct.roles[keyName].subsite_id, arguments.userid);
// Verify a profile page exists
if ( variables.roles[keyName].pageID GT 0 )
{
// Set the profile page URL
variables.roles[keyName].pageURL = application.ptProfile.csdata.getCSPageURL(variables.roles[keyName].pageID);
}
else
{
// Set the profile page URL
variables.roles[keyName].pageURL = "";
}
}
else
{
// Set the role page ID for the user
variables.roles[keyName].pageID = 0;
// Set the profile page URL
variables.roles[keyName].pageURL = "";
}
}