Doesn't populate default data #2

Open
orcpac7 opened this Issue Feb 13, 2012 · 5 comments

Projects

None yet

2 participants

@orcpac7
orcpac7 commented Feb 13, 2012

Dropped "Solitary" into modules directory, made changes as documented to Application.cfc for mapping and ORM enabled.
Browsed root index.cfm and added ?fwreinit=1
Tables were generated but no default info populated.
error sometimes is:
"Invalid CFML construct found on line 37 at column 17.
ColdFusion was looking at the following text:

for

The CFML compiler was processing:

A script statement beginning with for on line 37, column 17.
A script statement beginning with private on line 34, column 9.

"
but if I populate a sample user by hand along with roles and users_roles, i can get the login screen.

@orcpac7
orcpac7 commented Feb 13, 2012

By commenting out the lines in the modules/solitary/model/install/install.cfc file as follows and manually populating the tables, including generating the UPH and EPH hashed values, I was able to log in. However it now errors indicating that "SETLASTUPDATED " is undefined. I'll keep hacking!
private void function setupRoles(){
var roles = xmlSearch(getConfigXML(),"/solitary/roles/role");

/*  for(var role in roles){
        var r = roleService.new();
        r.setname(role.xmlText);
        userService.save(r);
    }

*/
log.info("The default role(s) were created successfully.");
}

private void function setupUsers(){
    var users = xmlSearch(getConfigXML(),"/solitary/users/user");

/* for(var user in users){
var u = userService.new();
u.setFirstName(user.xmlChildren[1].xmlText);
u.setLastName(user.xmlChildren[2].xmlText);
u.setEmail(user.xmlChildren[3].xmlText);
u.setUsername(user.xmlChildren[4].xmlText);
u.setPassword(user.xmlChildren[5].xmlText);

        // loop list of roles
        for(var x=1; x<=listLen(user.xmlChildren[6].xmlText); ++x){
            // try and find the role by name
            var r = roleService.findWhere({name=listGetAt(user.xmlChildren[6].xmlText,x)});
            u.addRole(r);
        }

        userService.save(u);
    }

*/
log.info("The default user(s) were created successfully.");
}

@orcpac7
orcpac7 commented Feb 13, 2012

OK, maybe something to do with recent upgrade to "ColdBox 3.1.0 NEAR-JAMES 4:8" or more likely my DBA has blocked functions for DDL through the DSN...
Anyway, I manually added properties to users and roles for dateCreated and lastUpdated and things are progressing nicely.

@orcpac7
orcpac7 commented Feb 13, 2012

OK,looks like your code depends on the code in the article you wrote "ColdFusion 9 ORM Event Handlers Use Case" for ORMEventHandler to do the updates of those missing fields. If that is the case, please add this dependency to your documentation or include the file in your distribution.
Regards,
JT

@cfaddict
Owner

Sorry but i am just looking at this now. I am pretty sure this was created for 3.0 release but I could be wrong. What vendor/version server are you running?

@orcpac7
orcpac7 commented Feb 17, 2012

Using Apache 2.2. webserver, ColdFusion 9.0.1 and ColdBox 3.1.0. I'm
talking to an Oracle 10 database hosted in house.

I've gotten it working, with manual installation steps...

I reverse engineered the installation script and created the three tables
by hand, got it working.
Then I dropped the tables and restarted my ColdFusion (9.0.1) server and
this time it created the tables for me.

It never did populate them with the initial data though, so I added the
roles, one admin user, and associated user to role by hand and got in OK.

Might be a mapping problem finding the XML file with the initial data, but
I haven't had time to debug as yet... To the wall gettting a little crud
application where users can get some initial data preparatory to building a
real application.

Thanks for your work and especially for publishing clear directions. It was
an eye-opener to me as I had read about AOP and security in ColdBox but was
still thinking of it as something I'd have to touch a lot of files to do
the way I want. MODULES, man, loving 'em!

That takes care of authentication, on to access control!

Regards,
J.T. Davis
ColdFusion Hacker since 0.89!

On Fri, Feb 17, 2012 at 8:22 AM, Dan Vega <
reply@reply.github.com

wrote:

Sorry but i am just looking at this now. I am pretty sure this was created
for 3.0 release but I could be wrong. What vendor/version server are you
running?


Reply to this email directly or view it on GitHub:
#2 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment