public void init() {
//If no user exist create a root-user
logger.debug("Initializing users...");
if (this.findUser(1) == null) {
logger.debug("Adding user root.");
JbsUser rootUser = new JbsUser();
JbsUserGroup rootGroup = manager.find(JbsUserGroup.class, new Long(1));
rootUser.setId(1);
rootUser.setMainGroup(rootGroup);
rootUser.setUserName("root");
rootUser.setPassword(StringUtils.encodeMD5("root"));
createUser(rootUser);
}
if (this.findUser(2) == null) {
logger.debug("Adding user test.");
JbsUser rootUser = new JbsUser();
JbsUserGroup rootGroup = manager.find(JbsUserGroup.class, new Long(1));
rootUser.setId(2);
rootUser.setMainGroup(rootGroup);
rootUser.setUserName("test");
rootUser.setPassword(StringUtils.encodeMD5("test"));
createUser(rootUser);
}
}