X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FdbObjects%2FSupportedUser.java;h=975ef9b51e02055fb444819a4330d43a42cadbab;hp=df5b54e88d0c5d5753c7bcfa4c4acf2ae3390dad;hb=f0409c63fad3833d4a2d4d8c3fd60f0ab829b299;hpb=aa5723dbb64ec8efa63909d39ff72364f0a5ee96 diff --git a/src/org/cacert/gigi/dbObjects/SupportedUser.java b/src/org/cacert/gigi/dbObjects/SupportedUser.java index df5b54e8..975ef9b5 100644 --- a/src/org/cacert/gigi/dbObjects/SupportedUser.java +++ b/src/org/cacert/gigi/dbObjects/SupportedUser.java @@ -1,9 +1,17 @@ package org.cacert.gigi.dbObjects; +import java.io.IOException; +import java.util.HashMap; +import java.util.Locale; + import org.cacert.gigi.GigiApiException; import org.cacert.gigi.database.GigiPreparedStatement; import org.cacert.gigi.dbObjects.Certificate.CertificateStatus; +import org.cacert.gigi.localisation.Language; +import org.cacert.gigi.output.template.MailTemplate; +import org.cacert.gigi.output.template.Outputable; import org.cacert.gigi.util.DayDate; +import org.cacert.gigi.util.ServerConstants; public class SupportedUser { @@ -19,21 +27,12 @@ public class SupportedUser { this.ticket = ticket; } - public boolean setName(Name newName) throws GigiApiException { - if (newName.equals(target.getName())) { - return false; - } - writeSELog("SE Name change"); - target.setName(newName); - return true; - } - public boolean setDob(DayDate dob) throws GigiApiException { if (dob.equals(target.getDoB())) { return false; } writeSELog("SE dob change"); - target.setDoB(dob); + target.setDoBAsSupport(dob); return true; } @@ -77,10 +76,6 @@ public class SupportedUser { return target; } - public void submitSupportAction() throws GigiApiException { - target.rawUpdateUserData(); - } - public void grant(Group toMod) { target.grantGroup(supporter, toMod); } @@ -89,4 +84,20 @@ public class SupportedUser { target.revokeGroup(supporter, toMod); } + private static final MailTemplate supportNotification = new MailTemplate(SupportedUser.class.getResource("SupportNotificationMail.templ")); + + public void sendSupportNotification(String subject, Outputable message) { + try { + HashMap vars = new HashMap<>(); + vars.put("supporter", supporter.getPreferredName().toString()); + vars.put("action", message); + vars.put("ticket", this.getTicket()); + vars.put("subject", subject); + + String supportemailaddress = "support@" + ServerConstants.getWwwHostName().replaceFirst("^www\\.", ""); + supportNotification.sendMail(Language.getInstance(Locale.ENGLISH), vars, supportemailaddress); + } catch (IOException e) { + e.printStackTrace(); + } + } }