Hi
I am trying to create Roller DB users programmitically, but somehow
these users are not being created in DB. Find below the snippet of code
i.e. trying to create roller user accounts, I check in the logs that
there are only SELECT queries of underlying JPA mechanism but cannot
locate any INSERT queries, i see insert queries in logs when I go
through the standard Roller user register page.
I have checked the code for Register action as well and cannot find any
differences, so any help is appreciated.
Thanks
Akshay
UserManager mgr = WebloggerFactory.getWeblogger().getUserManager();
User user = new User();
user .setDateCreated(new java.util.Date());
user .setFullName(username);
user .setUserName(username);
user .setScreenName(username);
user .setEnabled(Boolean.TRUE);
user .setPassword("password");
user.setLocale(Locale.getDefault().toString());
try {
// logger.debug("Assigning editor role");
// user.grantRole("editor");
logger.debug("ADD USER START:"+user);
mgr.addUser(user);
logger.debug("ADD USER END"+user);
logger.debug("Checking user exists :"+mgr.getUserByUserName(username));
WebloggerFactory.getWeblogger().flush();
logger.debug("Checking user exists :"+mgr.getUserByUserName(username));
} catch (WebloggerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
If you have received this e-mail in error, please return it to the sender
immediately and delete it and any attachments from your system. Morse plc is
the UK holding company for various international subsidiaries trading as Morse.
The registered office for Morse Group Limited (Company Number 2212268) and its
UK group undertakings is Profile West, 950 Great West Road, Brentford,
Middlesex TW8 9EE. VAT Registration 673 0084 47.