method injectPropertyMixin was not found

I'm running ColdBox 3.0.0 Beta 3, the advanced application template,
and I've integrated the security interceptor (with securityrules.xml).
I'm getting the following error...

The method injectPropertyMixin was not found in component
model.managers.security.

This seems internal to ColdBox, as it's not in any of my code (a
search for 'mixin' only brings results in the coldbox folder). Could
this be a bug in the beta version of ColdBox? My IOC stuff? Could I be
using something in my methods that relies on this that I could remove/
change?

Any direction to what I could look at or how I could solve this would
be awesome.

Thanks,
Thomas

I forgot to mention that I have converted the sample security app from
LightWire to ColdSpring... perhaps I didn't totally wire it up right?

I'm guessing this is somehow related to autowiring? The security.cfc
uses cfproperty to inject the userManager. Here are the first two
lines of the model.managers.secuirty"

<cfcomponent output="false" extends="Base" autowire="true">
<cfproperty name="userManager" type="ioc" scope="variables">

It's also intermittent (or perhaps related to the calling page).
Sometimes it throws the error and other times it takes me to record
editor screen.

So, I figured out that I was pretty much doing it all wrong.
Autowiring is for handlers I think. I hope no one spent too much time
(on Christmas, yeah right) reading or thinking about this.

I do have a few last questiona that I hope someone would be kind
enough to answer:

In the security sample app the model.security.cfc has a isUserVerified
method, and within that method, is the following:

<cfset var user = getManager("user").getUserByPropertyMap(arguments)>

The getManager method is a part of the base.cfc model, and uses:

<cfset var manager = CreateObject
("component",arguments.componentName).init(getTransfer(),getColdBox
()) />

So my questions are... Is it necessary to do it this way? Or, maybe I
should ask why is it done this way. Is it because the sample app uses
LightWire, or would it be the same for ColdSpring?

If I setup my dependencies correctly in ColdSpring, what is the best
method to use/call the model.UserManager bean in the model.security
cfc? I can't use getPlugin, and I can't use cfproperty right?

Thanks again and merry Christmas!

Thomas

Hi Thomas,

You can put whatever code you like inside the userValidator method,
it's up to you how you check that the user is authorised.

Here is an simplified example that I've used in the past with Transfer
(using ColdBox 3 but the principle is the same)

<cfcomponent hint="I am the facade for the security package"
extends="model.abstract.AbstractService" output="false">

  <cfproperty name="Transfer" inject="ocm" scope="instance" />
  <cfproperty name="SessionStorage"
inject="coldbox:plugin:SessionStorage" scope="instance" />

  --->
  <cffunction name="getCurrentUser" returntype="component" output="false">
    <cfscript>
    var User = "";
    
    if ( instance.SessionStorage.exists( 'userid') )
    {
      User = instance.Transfer.get( 'security.User',
instance.SessionStorage.getVar( 'userid' ) );
    }
    else
    {
      User = newUser();
    }
    return User;
    </cfscript>
  </cffunction>

  <cffunction name="userValidator" returntype="boolean" output="false"
hint="Mandatory method for ColdBox security interceptor"
description="This method is only called if an event matching the
securelist in securityrules.xml.cfm is called">
    <cfargument name="rule" type="struct" required="true" />
    <cfargument name="messagebox" type="component" required="true" />
    <cfargument name="controller" type="component" required="true" />
    <cfscript>
    var User = getCurrentUser();
    var authorised = false;
    // list of allowed roles
    var allowedRoles = arguments.rule.roles;
    var userRoles = "";
    var userRolesList = "";
    var i = 0;
    
    if ( User.hasRole() )
    {
      // get assigned role
      userRoles = User.getRole();
      
      /*
        if we have an array of roles loop
      */
      if ( IsArray( userRoles ) )
      {
        for( i = 1; i lte ArrayLen( userRoles ); i++ )
        {
          if ( ListFindNoCase( allowedRoles, userRoles[ i ].getName() ) != 0 )
          {
            authorised = true;
            break;
          }
        }
      }
    }

    return authorised;
    </cfscript>
  </cffunction>
</cfcomponent>

HTH

- John

Thanks John....

In the end I wasn't injecting the UserManager correctly into the
SecurtyManager because of base.cfc, but my first assumption was that
it worked differently within ColdBox than in a normal application. Bad
assumption. After changing the code all works as expected.

Thomas

I've been getting this error too, and have tracked it down to where
I'm using viewlets (runEvent() in a view) - but am still short on
ideas as to how to fix it.

Anybody else experiencing this? Would love to get rid of these error
messages clogging up my logs.

Thanks,
Craig

Hmm, interesting. Hopefully, some changes on m4 on svn will address this.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Thanks Luis, I'll grab M4 from SVN, give it a whirl and report back.

Happy to report that the injectPropertyMixin bug is gone with the
latest update to SVN M4.

Thanks again for the great work Luis! Is there a way to contribute a
patch/diff to the assembla svn? I found a bug in the JSON that I
reported a few months ago but seems it's still lurking in the latest
SVN releases and would like to get it contributed.

Cheers,
Craig

Yes, you can post the patches here for sure!!

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com