diff --git a/hsarback/src/de/hsadmin/core/model/Transaction.java b/hsarback/src/de/hsadmin/core/model/Transaction.java index 98a5f5e..ad57110 100644 --- a/hsarback/src/de/hsadmin/core/model/Transaction.java +++ b/hsarback/src/de/hsadmin/core/model/Transaction.java @@ -208,7 +208,7 @@ public class Transaction { return true; // 2-letter hostmaster } String hostmasterAccountPrefix = Config.getInstance().getProperty("accountprefix.hostmaster", "hsh01") + "-"; - if (ticketUser != null && ticketUser.startsWith(hostmasterAccountPrefix) && ticketUser.length() == 9) { + if (ticketUser != null && ticketUser.startsWith(hostmasterAccountPrefix) && ticketUser.length() == 8) { return true; // hsh01 hostmaster } if (ticketUser != null && ticketUser.length() == 5) { @@ -218,10 +218,10 @@ public class Transaction { String pacName = unixUser.getPac().getName(); return ticketUser.equals(pacName); // pac-admin } - if (ticketUser != null && ticketUser.length() == 3) { - String memberAccountPrefix = Config.getInstance().getProperty("accountprefix.customer", "hsh00") + "-"; + String memberAccountPrefix = Config.getInstance().getProperty("accountprefix.customer", "hsh00") + "-"; + if (ticketUser != null && (ticketUser.length() == 3 || (ticketUser.length() == 9 && ticketUser.startsWith(memberAccountPrefix)))) { Query memberQuery = getEntityManager().createQuery("SELECT c FROM Customers c WHERE c.name = :membername"); - memberQuery.setParameter("membername", memberAccountPrefix + ticketUser); + memberQuery.setParameter("membername", ticketUser.length() == 3 ? (memberAccountPrefix + ticketUser) : ticketUser); Customer member = (Customer) memberQuery.getSingleResult(); Set pacs = member.getPacs(); for (Pac p : pacs) {