Re: [framework-one] RC scope "gone" on Railo (works on Adobe)

78 views
Skip to first unread message

Matt Quackenbush

unread,
Oct 9, 2012, 11:15:39 AM10/9/12
to framew...@googlegroups.com
Can you post the entire checkAuthorization method?


On Tue, Oct 9, 2012 at 10:01 AM, notronwest <dil...@gmail.com> wrote:
I am cross posting this here in hopes that this is a simple fix or maybe someone has ran into this.  The original post is here: https://groups.google.com/forum/?fromgroups=#!topic/railo/LwTpw5aXGYw

I have developed a FW/1 application using Adobe ColdFusion version 9 with no issues. I am trying to port this application over to my hosting provider where I am using Railo.

In my Application.cfc I have this line in "setupRequest()":

controller( "security.checkAuthorization" );

In security.cfc my "checkAuthorization()" method has the following line:

if( session.userID eq 0 and rc.action neq "security.login" and rc.action neq "security.authenticate" )

When I run this on Adobe ColdFusion - everything is fine.  When I run this application on Railo I receive:

key [ACTION] doesn't exist in struct

Anyone seen something like this?

--
FW/1 on RIAForge: http://fw1.riaforge.org/
 
FW/1 on github: http://github.com/seancorfield/fw1
 
FW/1 on Google Groups: http://groups.google.com/group/framework-one

Joe Brislin

unread,
Oct 9, 2012, 12:21:26 PM10/9/12
to framew...@googlegroups.com
First question would be does your controller method have rc passed in as an argument?

function checkAuthorization( rc ){
}

The rc scope should be available within your controller method. We are currently converting a site over to Railo and everything functions as expected in terms of FW/1. The other question that I have though is why would you pass in the action with the rc.scope. Why aren't you just using variables.fw.getFullyQualifiedAction()?

-- 
Joe Brislin

notronwest

unread,
Oct 9, 2012, 1:24:11 PM10/9/12
to framew...@googlegroups.com
Here is my code:

component {
public pickem.controllers.security function init ( required fw ){
variables.fw = fw;
variables.oGateway = new pickem.model.gateway.user();
variables.oService = new pickem.model.services.user();
return this;
}

public void function before( Required struct rc){
variables.rc.bIsDialog = false;
}

public void function checkAuthorization(){
// force all users to login
if( session.nUserID eq 0 and variables.rc.action neq "security.login" and variables.rc.action neq "security.authenticate" ){
variables.fw.redirect("security.login");
} else {
// set the session scope into rc
variables.rc.stUser = session;
}
}

.... some other methods ....

}

I wasn't aware that you needed to pass rc around so much... I see in the docs now that it is advised in the before (and other default methods), but I thought that it was available in any actions method.

What's interesting is the application works in its entirety on Adobe CF.

notronwest

unread,
Oct 9, 2012, 1:28:21 PM10/9/12
to framew...@googlegroups.com
Ok, switching to variables.fw.getFullyQualifiedAction() worked.  Thanks.

Matt Quackenbush

unread,
Oct 9, 2012, 7:13:41 PM10/9/12
to framew...@googlegroups.com
BTW, you should *not* be scoping 'rc' in the variables scope of your controllers. That will cause all kinds of problems. You _should_, however, as Joe noted, have an rc argument for each and every method in your controller that you expect to be called as an event.

HTH
Reply all
Reply to author
Forward
0 new messages