From f52976e984450d6802067acad12a0b8143f4ce75 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 19 Sep 2013 17:55:26 +0200 Subject: some bugfixes --- .../moa/id/configuration/Constants.java | 1 + .../configuration/struts/action/EditOAAction.java | 22 +++++++++++++--------- .../configuration/struts/action/IndexAction.java | 11 ++++++++++- .../struts/action/UserManagementAction.java | 11 ++++++++++- 4 files changed, 34 insertions(+), 11 deletions(-) (limited to 'id/ConfigWebTool') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java index 47e6e83d5..2705659cb 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java @@ -44,6 +44,7 @@ public class Constants { public static final String IDENIFICATIONTYPE_FN = "FN"; public static final String IDENIFICATIONTYPE_ERSB = "ERSB"; public static final String IDENIFICATIONTYPE_ZVR = "ZVR"; + public static final String IDENIFICATIONTYPE_BASEID = "urn:publicid:gv.at:baseid+"; public static final String PREFIX_WPBK = "urn:publicid:gv.at:wbpk+"; } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index 8d20fe118..f160e3e51 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -105,7 +105,8 @@ ServletResponseAware { else { UserDatabase userdb = ConfigurationDBRead.getUserWithID(authUser.getUserID()); - if (!userdb.isIsMailAddressVerified() && !authUser.isAdmin()) { + if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null + && !userdb.isIsMailAddressVerified()) { log.info("Online-Applikation managemant disabled. Mail address is not verified."); addActionError(LanguageHelper.getErrorString("error.editoa.mailverification")); } @@ -162,7 +163,8 @@ ServletResponseAware { authUser = (AuthenticatedUser) authUserObj; UserDatabase userdb = ConfigurationDBRead.getUserWithID(authUser.getUserID()); - if (!userdb.isIsMailAddressVerified() && !authUser.isAdmin()) { + if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null + && !userdb.isIsMailAddressVerified()) { log.info("Online-Applikation managemant disabled. Mail address is not verified."); addActionError(LanguageHelper.getErrorString("error.editoa.mailverification")); } @@ -316,17 +318,19 @@ ServletResponseAware { onlineapplication.setIsAdminRequired(false); - UserDatabase user = ConfigurationDBRead.getUsersWithOADBID(onlineapplication.getHjid()); - if (user != null) { + if (onlineapplication.getHjid() != null) + userdb = ConfigurationDBRead.getUsersWithOADBID(onlineapplication.getHjid()); + + if (userdb != null && !authUser.isAdmin()) { try { MailHelper.sendUserOnlineApplicationActivationMail( - user.getGivenname(), - user.getFamilyname(), - user.getInstitut(), + userdb.getGivenname(), + userdb.getFamilyname(), + userdb.getInstitut(), onlineapplication.getPublicURLPrefix(), - user.getMail()); + userdb.getMail()); } catch (ConfigurationException e) { - log.warn("Sending Mail to User " + user.getMail() + " failed", e); + log.warn("Sending Mail to User " + userdb.getMail() + " failed", e); } } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java index 545a84800..5a88b1324 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java @@ -128,6 +128,10 @@ public class IndexAction extends ActionSupport implements ServletRequestAware, return Constants.STRUTS_ERROR; } else { + //TODO: maybe remove this default value in a later version + if (dbuser.isIsUsernamePasswordAllowed() == null) + dbuser.setIsUsernamePasswordAllowed(true); + if (!dbuser.isIsActive() || !dbuser.isIsUsernamePasswordAllowed()) { log.warn("Username " + dbuser.getUsername() + " is not active or Username/Password login is not allowed"); addActionError(LanguageHelper.getErrorString("webpages.index.login.notallowed")); @@ -140,6 +144,11 @@ public class IndexAction extends ActionSupport implements ServletRequestAware, return Constants.STRUTS_ERROR; } + //TODO: maybe remove this default value in a later version + boolean ismandateuser = false; + if (dbuser.isIsMandateUser() != null) + ismandateuser = dbuser.isIsMandateUser(); + AuthenticatedUser authuser = new AuthenticatedUser( dbuser.getHjid(), dbuser.getGivenname(), @@ -148,7 +157,7 @@ public class IndexAction extends ActionSupport implements ServletRequestAware, dbuser.getUsername(), true, dbuser.isIsAdmin(), - dbuser.isIsMandateUser(), + ismandateuser, false); Date date = DateTimeHelper.parseDateTime(dbuser.getLastLogin()); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java index 6bc90a417..0e75b5b80 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java @@ -484,8 +484,17 @@ public class UserManagementAction extends ActionSupport dbuser.setGivenname(user.getGivenName()); dbuser.setInstitut(user.getInstitut()); - if (authUser.isAdmin()) + if (authUser.isAdmin()) { dbuser.setBpk(user.getBpk()); + if ( user.getBpk().startsWith(Constants.IDENIFICATIONTYPE_BASEID + + "X" + Constants.IDENIFICATIONTYPE_FN) || + user.getBpk().startsWith(Constants.IDENIFICATIONTYPE_BASEID + + "X" + Constants.IDENIFICATIONTYPE_ZVR) || + user.getBpk().startsWith(Constants.IDENIFICATIONTYPE_BASEID + + "X" + Constants.IDENIFICATIONTYPE_ERSB)) { + dbuser.setIsMandateUser(true); + } + } } else { if (!dbuser.isIsMandateUser()) -- cgit v1.2.3