This commit is contained in:
Peter Hormanns 2012-06-12 14:48:09 +00:00
parent 26027b2896
commit 9dcae446ee

View File

@ -208,7 +208,7 @@ public class Transaction {
return true; // 2-letter hostmaster return true; // 2-letter hostmaster
} }
String hostmasterAccountPrefix = Config.getInstance().getProperty("accountprefix.hostmaster", "hsh01") + "-"; 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 return true; // hsh01 hostmaster
} }
if (ticketUser != null && ticketUser.length() == 5) { if (ticketUser != null && ticketUser.length() == 5) {
@ -218,10 +218,10 @@ public class Transaction {
String pacName = unixUser.getPac().getName(); String pacName = unixUser.getPac().getName();
return ticketUser.equals(pacName); // pac-admin 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"); 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(); Customer member = (Customer) memberQuery.getSingleResult();
Set<Pac> pacs = member.getPacs(); Set<Pac> pacs = member.getPacs();
for (Pac p : pacs) { for (Pac p : pacs) {