DROP TABLE IF EXISTS "user_groups";
DROP TYPE IF EXISTS "userGroup";
-CREATE TYPE "userGroup" AS enum('supporter','arbitrator','blockedassuree','blockedassurer','blockedlogin','ttp-assurer','ttp-applicant', 'codesigning', 'orgassurer', 'blockedcert', 'nucleus-assurer', 'locate-agent');
+CREATE TYPE "userGroup" AS enum('supporter','arbitrator','blockedassuree','blockedassurer','blockedlogin','ttp-assurer','ttp-applicant', 'codesigning', 'orgassurer', 'blockedcert', 'nucleus-assurer', 'locate-agent', 'verify-notification');
CREATE TABLE IF NOT EXISTS "user_groups" (
"id" serial NOT NULL,
"version" smallint NOT NULL,
PRIMARY KEY ("version")
);
-INSERT INTO "schemeVersion" (version) VALUES(23);
+INSERT INTO "schemeVersion" (version) VALUES(24);
DROP TABLE IF EXISTS `passwordResetTickets`;
CREATE TABLE `passwordResetTickets` (
CODESIGNING("codesigning", "may issue codesigning certificates", true, false, false), //
ORGASSURER("orgassurer", "may verify organisations", true, false, true), //
NUCLEUS_ASSURER("nucleus-assurer", "may enter nucleus verifications", true, false, true), //
- LOCATE_AGENT("locate-agent", "wants access to the locate agent system", false, true, false);
+ LOCATE_AGENT("locate-agent", "wants access to the locate agent system", false, true, false), //
+ VERIFY_NOTIFICATION("verify-notification", "wants to receive an email notification for any Verification they enter", false, true, false);
private final String dbName;
public static final Group ASSUREE_BLOCKED = Group.BLOCKEDASSUREE;
+ public static final Group VERIFY_NOTIFICATION = Group.VERIFY_NOTIFICATION;
+
/**
* This method assures another user.
*
assure(assurer, assuree, toAssure[i], dob, awarded, location, date, type, country);
}
sendVerificationNotificationApplicant(assurer, assuree, toAssure, awarded, hadLessThan50Points, hadTotalLessThan100);
+ if (assurer.isInGroup(VERIFY_NOTIFICATION)) {
+ sendVerificationNotificationAgent(assurer, assuree, toAssure, awarded, location, date, country);
+ }
}
private static final MailTemplate verificationEntered = new MailTemplate(Notary.class.getResource("VerificationEntered.templ"));
+ private static final MailTemplate verificationAgentEntered = new MailTemplate(Notary.class.getResource("VerificationAgentEntered.templ"));
+
private static void sendVerificationNotificationApplicant(User assurer, User assuree, Name[] toAssure, final int awarded, final boolean[] hadLessThan50Points, boolean hadTotalLessThan100) {
HashMap<String, Object> mailVars = new HashMap<>();
mailVars.put("agent", assurer.getPreferredName().toString());
e.printStackTrace();
}
}
+
+ private static void sendVerificationNotificationAgent(User agent, User applicant, Name[] toVerify, final int awarded, String location, String date, Country country) {
+ HashMap<String, Object> mailVars = new HashMap<>();
+ mailVars.put("email", applicant.getEmail());
+ mailVars.put("location", location);
+ mailVars.put("date", date);
+ mailVars.put("country", country.getName());
+ mailVars.put("points", Integer.toString(awarded));
+ mailVars.put("names", new ArrayIterable<Name>(toVerify) {
+
+ @Override
+ public void apply(Name t, Language l, Map<String, Object> vars) {
+ vars.put("name", t.toString());
+ }
+
+ });
+
+ try {
+ verificationAgentEntered.sendMail(Language.getInstance(applicant.getPreferredLocale()), mailVars, agent.getEmail());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
}