CREATE TABLE IF NOT EXISTS `user_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` int(11) NOT NULL,
- `permission` enum('supporter','arbitrator','blockedassuree','blockedassurer','ttp-assuer','codesigning') NOT NULL,
+ `permission` enum('supporter','arbitrator','blockedassuree','blockedassurer','ttp-assuer','ttp-applicant', 'codesigning') NOT NULL,
`granted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` timestamp NULL DEFAULT NULL,
`grantedby` int(11) NOT NULL,
import org.cacert.gigi.pages.main.RegisterPage;
import org.cacert.gigi.pages.wot.AssurePage;
import org.cacert.gigi.pages.wot.MyPoints;
+import org.cacert.gigi.pages.wot.RequestTTPPage;
import org.cacert.gigi.ping.PingerDaemon;
import org.cacert.gigi.util.ServerConstants;
putPage(MailOverview.DEFAULT_PATH, new MailOverview("My email addresses"), "Certificates");
putPage(DomainOverview.PATH + "*", new DomainOverview("Domains"), "Certificates");
putPage(MyPoints.PATH, new MyPoints("My Points"), "CAcert Web of Trust");
+ putPage(RequestTTPPage.PATH, new RequestTTPPage(), "CAcert Web of Trust");
putPage("/wot/rules", new StaticPage("CAcert Web of Trust Rules", AssurePage.class.getResourceAsStream("Rules.templ")), "CAcert Web of Trust");
baseTemplate = new Template(Gigi.class.getResource("Gigi.templ"));
rootMenu = new Menu("Main");
--- /dev/null
+package org.cacert.gigi.pages.wot;
+
+import java.io.PrintWriter;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.cacert.gigi.GigiApiException;
+import org.cacert.gigi.dbObjects.Group;
+import org.cacert.gigi.dbObjects.User;
+import org.cacert.gigi.localisation.Language;
+import org.cacert.gigi.output.Form;
+import org.cacert.gigi.output.template.OutputableArrayIterable;
+import org.cacert.gigi.output.template.Template;
+import org.cacert.gigi.pages.LoginPage;
+
+public class RequestTTPForm extends Form {
+
+ public static final Group TTP_APPLICANT = Group.getByString("ttp-applicant");
+
+ private static final Template t = new Template(RequestTTPForm.class.getResource("RequestTTPForm.templ"));
+
+ private User u;
+
+ public RequestTTPForm(HttpServletRequest hsr) {
+ super(hsr);
+ u = LoginPage.getUser(hsr);
+ }
+
+ private final String[] COUNTRIES = new String[] {
+ "Australia", "Puerto Rico", "USA"
+ };
+
+ @Override
+ public boolean submit(PrintWriter out, HttpServletRequest req) throws GigiApiException {
+ String country = req.getParameter("country");
+ if (country != null) {
+ int cid = Integer.parseInt(country);
+ if (cid < 0 || cid >= COUNTRIES.length) {
+ throw new GigiApiException("Invalid country id");
+ }
+ country = COUNTRIES[cid];
+ }
+ User u = LoginPage.getUser(req);
+ u.grantGroup(u, TTP_APPLICANT);
+
+ return false;
+ }
+
+ @Override
+ protected void outputContent(PrintWriter out, Language l, Map<String, Object> map) {
+ map.put("countries", new OutputableArrayIterable(COUNTRIES, "country"));
+
+ t.output(out, l, map);
+ }
+
+}
--- /dev/null
+<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper dataTable">
+ <tr>
+ <td class="DataTD"><?=_Country where you want to visit the TTP?></td>
+ <td class="DataTD"><select size="1" name="country">
+ <? foreach($countries) {?>
+ <option value="<?=$i?>"><?=$country?></option>
+ <? } ?>
+ </select></td>
+ </tr>
+<!-- <tr>
+ <td class="DataTD"><?=_I want to take part in the TTP Topup programme?></td>
+ <td class="DataTD"><input type="checkbox" name="ttptopup" value="1"></td>
+ </tr>-->
+ <tr>
+ <td colspan="2" >
+ <input type="submit" name="ttp" value="<?=_I need a TTP assurance?>">
+ </td>
+ </tr>
+</table>
--- /dev/null
+package org.cacert.gigi.pages.wot;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.cacert.gigi.GigiApiException;
+import org.cacert.gigi.dbObjects.Assurance;
+import org.cacert.gigi.dbObjects.User;
+import org.cacert.gigi.output.Form;
+import org.cacert.gigi.pages.LoginPage;
+import org.cacert.gigi.pages.Page;
+
+public class RequestTTPPage extends Page {
+
+ public static final String PATH = "/wot/ttp";
+
+ public RequestTTPPage() {
+ super("Request TTP");
+ }
+
+ @Override
+ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ try {
+ Form.getForm(req, RequestTTPForm.class).submit(resp.getWriter(), req);
+ } catch (GigiApiException e) {
+ e.format(resp.getWriter(), getLanguage(req));
+ }
+ }
+
+ @Override
+ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ User u = LoginPage.getUser(req);
+ HashMap<String, Object> map = new HashMap<String, Object>();
+ if (u.isInGroup(RequestTTPForm.TTP_APPLICANT)) {
+ map.put("inProgress", true);
+ } else {
+ if (u.getAssurancePoints() < 100) {
+ int ttpCount = 0;
+ for (Assurance a : u.getReceivedAssurances()) {
+ if (a.getMethod().equals(Assurance.AssuranceType.TTP_ASSISTED.getDescription())) {
+ ttpCount++;
+ }
+ }
+ if (ttpCount < 2) {
+ map.put("ttp", true);
+ map.put("form", new RequestTTPForm(req));
+ } else {
+ map.put("nothing", true);
+ }
+ } else {
+ map.put("nothing", true);
+ }
+ }
+ map.put("form", new RequestTTPForm(req));
+ getDefaultTemplate().output(resp.getWriter(), getLanguage(req), map);
+ }
+
+}
--- /dev/null
+<h3><?=_Trusted Third Parties?></h3>
+
+<p><?=_The Trusted Third Party (TTP) programme is intended to be used in areas without many CAcert Assurers.?></p>
+
+<p><?=_A Trusted Third Party (TTP) is simply someone in your country that is responsible for witnessing signatures and ID documents. This role is covered by many different titles such as public notary, justice of the peace and so on.?></p>
+
+<p><?=_With the TTP programme you can potentially gain assurance up to a maximum of 100 assurance points.?></p>
+
+<p><?=_Currently CAcert has only developed the TTP programme to the level that you can gain 70 assurance points by TTP assurances.?></p>
+
+<p><?=_We are working to develop a process that will fill the gap of the missing 30 assurance points to allow you to get the maximum 100 assurance points.?> </p>
+
+<p><?=_In the meanwhile you would need to close this gap with face to face assurances with CAcert Assurers. Think not only travelling to populated countries, but also remember that assurers may occasionally visit your country or area.?></p>
+
+<p><?=s,"<a href='//wiki.cacert.org/TTP/TTPuser'>https://wiki.cacert.org/TTP/TTPuser</a>","<a href='//wiki.cacert.org/TTP/TTPAL'>https://wiki.cacert.org/TTP/TTPAL</a>",If you are interested in the TTP programme, read the pages %s for the basic way how the TTP programme works for you, and %s whether the TTP programme affects the country where you are located.?> </p>
+
+<? if($ttp) { ?>
+<p><?=_If you want to ask for TTP assurances fill out the missing data and send the request to support@cacert.org to start the process. CAcert will then inform you about the next steps.?></p>
+<?=$form?>
+<? } ?>
+
+<? if($topup) { ?>
+<p><?=_As you have already got 2 TTP assurances you can only take part in the TTP TOPUP programme. If you want to ask for the TTP TOPUP programme use the submit button to send the request to support@cacert.org to start the process. CAcert will then inform you about the next steps.?></p>
+<form method="post" action="ttp">
+ <input type="submit" name="ttptopup" value="<?=_I need a TTP TOPUP?>">
+</form>
+<p><?=_We are working to develop the TTP TOPUP process to be able to fill the gap of the missing 30 assurance points to 100 assurance points. Meanwhile you have to close this gap with face to face assurances from CAcert Assurers. Think not only travelling to populated countries, but as well to assurers visiting your country or area.?></p>
+<? } ?>
+
+<? if($nothing) { ?>
+<p><?=_You reached the maximum points that can be granted by the TTP programme and therefore you cannot take part in the TTP programme any more.?></p>
+<? } ?>
+<? if($inProgress) { ?>
+<p><?=_Your request for a TTP assurance is in progress. Please be patient.?></p>
+<? } ?>