stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
List<DcObject> users = WorkFlow.getInstance().convert(rs, new int[] {User._ID, User._A_LOGINNAME, User._B_ENABLED, User._C_NAME, User._L_ADMIN});
User user;
if (users.size() == 1) {
user = (User) users.get(0);
sql = "select * from permission where user = '" + user.getID() + "'";
rs = stmt.executeQuery(sql);
List<DcObject> permissions = WorkFlow.getInstance().convert(rs, new int[] {Permission._ID,
Permission._A_PLUGIN,
Permission._B_FIELD,
Permission._C_MODULE,
Permission._D_VIEW,
Permission._E_EDIT,
Permission._F_USER});
for (DcObject permission : permissions)
user.addChild(permission);
stmt.close();
} else {
stmt.close();
connection.close();
throw new SecurityException(DcResources.getText("msgUserOrPasswordIncorrect"));
}
if (!(Boolean) user.getValue(User._B_ENABLED))
throw new SecurityException(DcResources.getText("msgLoginNotAllowed"));
SecuredUser su = new SecuredUser(user, password);
this.users.put(user.getID(), su);
// web users hold their own reference of the logged in user
if (!web)
this.user = (User) users.get(0);