I am trying to set a bean with some values from a new interceptor which I created. At first I placed the sets in the preProcess of the security interceptor (security module interceptor) and everything was working fine and values get set and stick in session. When I created a custom interceptor and copied the code from the preProcess in the security interceptor the values no longer get set. I dump the projectBean.getThis() and I can see them set but when I dump the it is all blank. Any ideas why it works fine in one interceptor but not another?? Thanks!
My interceptor settings in ColdBox.cfc:
//Register interceptors as an array, we need order
interceptors = [
// SES
{class=“coldbox.system.interceptors.SES”},
// User interceptor
{class=“interceptors.userSession”},
// Security - handles PKI and NONPKI logon
{class=“cbsecurity.interceptors.Security”,
name=“CBSecurity”,
properties = {
// please add the properties you want here to configure the security interceptor
rulesFile = “/cbsecurity/config/security.json.cfm”,
rulesSource = “json”
}
}
];
My Bean:
component accessors=“true” scope=“session” singleton {
property name=“projects”;
property name=“projTitle”;
property name=“projId”;
property name=“parentProjId”;
property name=“bannerImage”;
property name=“defaultPhase”;
property name=“dsn”;
property name=“editDuration”;
property name=“myKey”;
property name=“parentDsn”;
property name=“phase”;
property name=“phaseTitle”;
property name=“prjEngName”;
property name=“projectLogo”;
/**
- Constructor
*/
function init(){
return this;
}
/* Utils */
function getThis(){
return this;
}
}
preProcess code:
var rc = event.getCollection(); var oSession = getInstance('SessionStorage@cbstorages');if (StructKeyExists(rc, “project”) and rc.project neq projectBean.getProjId()) {
// Set user info for this project/phase
userBean.setUsername(oSession.getVar(“username”));
// Set project settings
var qry = proj.getProjectSettings(rc.project);
projectBean.setProjId(qry.projId);
projectBean.setProjTitle(qry.title);
projectBean.setParentProjId(qry.parentProjId);
projectBean.setBannerImage(qry.bannerImage);
projectBean.setDefaultPhase(qry.defaultPhase);
projectBean.setDsn(qry.dsn);
projectBean.setEditDuration(qry.editDuration);
projectBean.setMyKey(qry.myKey);
projectBean.setParentDsn(qry.parentDsn);
projectBean.setPhase(qry.phase);
projectBean.setPhaseTitle(qry.phaseTitle);
projectBean.setPrjEngName(qry.prjEngName);
projectBean.setProjectLogo(qry.projectLogo);
(dump you see below)
writedump(projectBean.getThis());
writedump(session);
abort;
}
Bean dump after setting:
component models.beans.projectBean
$MIXED true
PROPERTIES
projects [empty string]
projTitle PROJECT1
projId 7
parentProjId [empty string]
bannerImage [empty string]
defaultPhase [empty string]
dsn PROJECT1
editDuration 90
myKey PROJECT1
parentDsn PROJECT1
phase [empty string]
phaseTitle [empty string]
prjEngName [empty string]
projectLogo [empty string]
METHODS
Session dump w empty values:
struct
cbox_flash_scope
struct [empty]
cbstorage
struct
sessionid E8034E3470215F75654809CF1F44703D.cfusion
urltoken CFID=21307&CFTOKEN=bfbd95ea2e9f2ccf-0806BFA4-5C26-0A61-9CA62637760D20B5&jsessionid=E8034E3470215F75654809CF1F44703D.cfusion
wirebox:projectbean
component models.beans.projectBean
$MIXED true
PROPERTIES
projects [empty string]
projTitle [empty string]
projId [empty string]
parentProjId [empty string]
bannerImage [empty string]
defaultPhase [empty string]
dsn [empty string]
editDuration [empty string]
myKey [empty string]
parentDsn [empty string]
phase [empty string]
phaseTitle [empty string]
prjEngName [empty string]
projectLogo [empty string]
METHODS