Gents,
1. I am attempting to prime the database with one group and a couple of
roles with one permission each. I do not need the full flux control over
those entities. I have my own User page that uses a pull tool to get a list
of the roles that my users can play. The problem lies in setting up a Group,
it does not work and the subsequent TurbineSecurity.grant(...) fails. I
assume because the Group I am trying to use is not there. The DatabasePrimer
runs as a TurbineBaseService. An excerpt from the code I use in
DatabasePrimer is:
....
log("Installing role, permission records into database");
String password = new String ("blahin");
try {
Permission adminperm =
TurbineSecurity.getNewPermission("Admin");
Permission msguserperm =
TurbineSecurity.getNewPermission("MsgUser");
Role adminrole = TurbineSecurity.getNewRole("Administrator");
Role msguserrole = TurbineSecurity.getNewRole("Message User");
Group rwtgroup = TurbineSecurity.getNewGroup("global");
<----here I tried
'Group.GLOBAL_GROUP_NAME' also
User adminuser = new TurbineUser();
try {
TurbineSecurity.addPermission(adminperm);
}
catch (EntityExistsException eee1) {
// It exists so that is good
sLogger.debug("DatabasePrimer: "+eee1.toString());
}
try {
TurbineSecurity.addRole(adminrole);
}
catch (EntityExistsException eee2) {
// It exists so that is good
sLogger.debug("DatabasePrimer: "+eee2.toString());
}
try {
TurbineSecurity.addPermission(msguserperm);
}
catch (EntityExistsException eee3) {
// It exists so that is good
sLogger.debug("DatabasePrimer: "+eee3.toString());
}
try {
TurbineSecurity.addRole(msguserrole);
}
catch (EntityExistsException eee4) {
// It exists so that is good
sLogger.debug("DatabasePrimer: "+eee4.toString());
}
if (TurbineSecurity.accountExists(username))
{
adminuser = TurbineSecurity.getUser(username);
sLogger.debug("DatabasePrimer: Administrator user
already exists");
}
else
{
Date now = new Date();
adminuser.setUserName("Admin");
adminuser.setCreateDate(now);
adminuser.setLastLogin(new Date(0));
TurbineSecurity.addUser(adminuser, password);
}
// Assume that grant is benign if adminuser exists with this
role
TurbineSecurity.grant(adminuser, rwtgroup, adminrole);
}
catch (EntityExistsException eee) {
etc.
I get the error:
DatabasePrimer: org.apache.turbine.util.security.DataBackendException:
grant(User,Group,Role) failed: General error: Column 'GROUP_ID' cannot be
null
The method TurbineSecurity.getNewGroup("global") does not perform as defined
in the javadoc. According to the javadocs it should return the object
associated with that name or if there is none then create one with that
name. Any work around here.
2. I notice from the turbine.log that DatabasePrimer gets runs twice, one
second apart, during initialisation. This is it's entry in
turbineresources.properties.
services.DatabasePrimer.classname=com.roamware.rwtransform.services.Database
Primer
Any reason for this?
Thanks,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]