]> WPIA git - gigi.git/commitdiff
Merge changes I8f2dfb5e,Ife185cda,I79a10fa7,Ib764cc42,I76efe755, ...
authorFelix Dörre <felix@dogcraft.de>
Fri, 5 Aug 2016 20:12:11 +0000 (22:12 +0200)
committerGerrit Code Review <gigi-system@dogcraft.de>
Fri, 5 Aug 2016 20:12:11 +0000 (22:12 +0200)
* changes:
  del: unused old css file
  upd: rename main css file more neutrally
  upd: format main css file
  upd: add minimal spacing to points summary table
  upd: rename "My Points" to "Points" for consistency with support view.
  add: new test cases for supporter view to points
  add: support should be able to see verifications of user

13 files changed:
src/org/cacert/gigi/Gigi.java
src/org/cacert/gigi/Gigi.templ
src/org/cacert/gigi/output/AssurancesDisplay.java
src/org/cacert/gigi/output/AssurancesDisplay.templ
src/org/cacert/gigi/pages/admin/support/SupportUserDetailsForm.templ
src/org/cacert/gigi/pages/wot/MyPoints.java [deleted file]
src/org/cacert/gigi/pages/wot/Points.java [new file with mode: 0644]
src/org/cacert/gigi/pages/wot/Points.templ [moved from src/org/cacert/gigi/pages/wot/MyPoints.templ with 60% similarity]
static/static/css/cacert.css [deleted file]
static/static/css/main.css [new file with mode: 0644]
static/static/default.css [deleted file]
tests/org/cacert/gigi/pages/admin/TestSEAdminPageDetails.java
tests/org/cacert/gigi/pages/wot/TestAssurance.java

index 9e111ae78449c50b600e7d08294c41c5fa712716..1c503666e338547faf69a208843d1fafbdea1a06 100644 (file)
@@ -68,7 +68,7 @@ import org.cacert.gigi.pages.main.RegisterPage;
 import org.cacert.gigi.pages.orga.CreateOrgPage;
 import org.cacert.gigi.pages.orga.ViewOrgPage;
 import org.cacert.gigi.pages.wot.AssurePage;
-import org.cacert.gigi.pages.wot.MyPoints;
+import org.cacert.gigi.pages.wot.Points;
 import org.cacert.gigi.pages.wot.RequestTTPPage;
 import org.cacert.gigi.ping.PingerDaemon;
 import org.cacert.gigi.util.AuthorizationContext;
@@ -145,7 +145,7 @@ public final class Gigi extends HttpServlet {
             putPage(DomainOverview.PATH + "*", new DomainOverview(), "Certificates");
 
             putPage(AssurePage.PATH + "/*", new AssurePage(), "Web of Trust");
-            putPage(MyPoints.PATH, new MyPoints(), "Web of Trust");
+            putPage(Points.PATH, new Points(false), "Web of Trust");
             putPage(RequestTTPPage.PATH, new RequestTTPPage(), "Web of Trust");
 
             putPage(TTPAdminPage.PATH + "/*", new TTPAdminPage(), "Admin");
@@ -170,6 +170,7 @@ public final class Gigi extends HttpServlet {
             putPage(UserTrainings.PATH, new UserTrainings(false), "My Account");
             putPage(MyDetails.PATH, new MyDetails(), "My Account");
             putPage(UserTrainings.SUPPORT_PATH, new UserTrainings(true), null);
+            putPage(Points.SUPPORT_PATH, new Points(true), null);
 
             putPage(PasswordResetPage.PATH, new PasswordResetPage(), null);
             putPage(LogoutPage.PATH, new LogoutPage(), null);
index 9884721a68457a01430d2dfa60e1c34b576a08bb..3c011941c48e601c111aedb47b721328f99d79ce 100644 (file)
@@ -10,7 +10,7 @@
         <meta name="viewport" content="width=device-width, initial-scale=1">
 
         <link rel="stylesheet" href="<?=$static?>/css/bootstrap.min.css">
-        <link rel="stylesheet" href="<?=$static?>/css/cacert.css">
+        <link rel="stylesheet" href="<?=$static?>/css/main.css">
 
         <script src="<?=$static?>/js/jquery.min.js"></script>
         <script src="<?=$static?>/js/bootstrap.min.js"></script>
index 8f0e6cabb54085287700e059db012ec1729aec35..f6d5362a62a4d0223f8a5a2122187616b5d20154 100644 (file)
@@ -18,9 +18,12 @@ public class AssurancesDisplay implements Outputable {
 
     public String assuranceArray;
 
-    public AssurancesDisplay(String assuranceArray, boolean assurer) {
+    private boolean support;
+
+    public AssurancesDisplay(String assuranceArray, boolean assurer, boolean support) {
         this.assuranceArray = assuranceArray;
         this.assurer = assurer;
+        this.support = support;
     }
 
     @Override
@@ -43,13 +46,16 @@ public class AssurancesDisplay implements Outputable {
                     return false;
                 } else {
                     Assurance assurance = assurances[i];
+                    vars.put("support", support);
                     vars.put("id", assurance.getId());
                     vars.put("method", assurance.getMethod());
                     Name to = assurance.getTo();
                     if (assurer) {
+                        vars.put("linkId", assurance.getTo().getOwner().getId());
                         vars.put("verbVal", to == null ? l.getTranslation("applicant's name removed") : to.getOwner().getId());
                         vars.put("myName", to == null ? l.getTranslation("applicant's name removed") : to);
                     } else {
+                        vars.put("linkId", assurance.getFrom().getId());
                         vars.put("verbVal", assurance.getFrom().getPreferredName());
                         vars.put("myName", to == null ? l.getTranslation("own name removed") : to);
                     }
index 1a552f063222a1a9bbb0bc4b26dc7de2dfca0698..a36e3583f1e748f53d599cc83810db07ef190a97 100644 (file)
 </tr>
 <? foreach($assurances) {?>
 <tr>
+<? if($support) { ?>
+<td><a href="/support/user/<?=$linkId?>"><?=$id?></a></td>
+<? } else { ?>
 <td><?=$id?></td>
+<? } ?>
 <td><?=$date?></td>
 <td><?=$verbVal?></td>
 <? if($myName) { ?>
index 08ea759759aa273e07f098643774eca4a3e15d94..b73cc6daa180f4e1fd77f92d6b24e8a213816a38 100644 (file)
@@ -32,9 +32,9 @@
             <? } ?>
             </td>
         </tr>
-               <tr>
+        <tr>
             <td><?=_Verification Points?>:</td>
-            <td><?=$assurancepoints?></td>
+            <td><?=$assurancepoints?> (<a href="./<?=$id?>/points"><?=_Show?></a>)</td>
         </tr>
         <tr>
             <td><?=_Experience Points?>:</td>
diff --git a/src/org/cacert/gigi/pages/wot/MyPoints.java b/src/org/cacert/gigi/pages/wot/MyPoints.java
deleted file mode 100644 (file)
index 69f5d7e..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-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.dbObjects.User;
-import org.cacert.gigi.output.AssurancesDisplay;
-import org.cacert.gigi.pages.Page;
-import org.cacert.gigi.util.AuthorizationContext;
-
-public class MyPoints extends Page {
-
-    public static final String PATH = "/wot/mypoints";
-
-    private AssurancesDisplay myDisplay = new AssurancesDisplay("asArr", false);
-
-    private AssurancesDisplay toOtherDisplay = new AssurancesDisplay("otherAsArr", true);
-
-    public MyPoints() {
-        super("My Points");
-    }
-
-    @Override
-    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
-        HashMap<String, Object> vars = new HashMap<String, Object>();
-        vars.put("pointlist", myDisplay);
-        vars.put("madelist", toOtherDisplay);
-        User user = getUser(req);
-        vars.put("asArr", user.getReceivedAssurances());
-        vars.put("otherAsArr", user.getMadeAssurances());
-        vars.put("assP", user.getAssurancePoints());
-        if (user.canAssure()) {
-            vars.put("expP", user.getExperiencePoints());
-            vars.put("maxP", user.getMaxAssurePoints());
-        }
-        getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars);
-    }
-
-    @Override
-    public boolean isPermitted(AuthorizationContext ac) {
-        return ac != null && ac.getTarget() instanceof User;
-    }
-}
diff --git a/src/org/cacert/gigi/pages/wot/Points.java b/src/org/cacert/gigi/pages/wot/Points.java
new file mode 100644 (file)
index 0000000..4538735
--- /dev/null
@@ -0,0 +1,77 @@
+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.dbObjects.User;
+import org.cacert.gigi.output.AssurancesDisplay;
+import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.util.AuthorizationContext;
+
+public class Points extends Page {
+
+    public static final String SUPPORT_PATH = "/support/user/*/points";
+
+    public static final String PATH = "/wot/points";
+
+    private static final int intStart = SUPPORT_PATH.indexOf('*');
+
+    private boolean support;
+
+    private AssurancesDisplay myDisplay;
+
+    private AssurancesDisplay toOtherDisplay;
+
+    public Points(boolean support) {
+        super(support ? "Support User Points" : "Points");
+        this.support = support;
+        myDisplay = new AssurancesDisplay("asArr", false, support);
+        toOtherDisplay = new AssurancesDisplay("otherAsArr", true, support);
+    }
+
+    @Override
+    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+        User user;
+        if (support) {
+            String info = req.getPathInfo();
+            int id = Integer.parseInt(info.substring(intStart, info.length() - SUPPORT_PATH.length() + intStart + 1));
+            user = User.getById(id);
+            if (user == null) {
+                resp.sendError(404);
+                return;
+            }
+        } else {
+            user = getUser(req);
+        }
+
+        HashMap<String, Object> vars = new HashMap<String, Object>();
+        vars.put("support", support);
+        vars.put("username", user.getPreferredName().toString());
+        vars.put("pointlist", myDisplay);
+        vars.put("madelist", toOtherDisplay);
+        vars.put("asArr", user.getReceivedAssurances());
+        vars.put("otherAsArr", user.getMadeAssurances());
+        vars.put("assP", user.getAssurancePoints());
+        if (user.canAssure()) {
+            vars.put("expP", user.getExperiencePoints());
+            vars.put("maxP", user.getMaxAssurePoints());
+        }
+        getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars);
+    }
+
+    @Override
+    public boolean isPermitted(AuthorizationContext ac) {
+        if (ac == null) {
+            return false;
+        }
+        if (support) {
+            return ac.canSupport();
+        } else {
+            return ac.getTarget() instanceof User;
+        }
+    }
+
+}
similarity index 60%
rename from src/org/cacert/gigi/pages/wot/MyPoints.templ
rename to src/org/cacert/gigi/pages/wot/Points.templ
index 1671f1ad111bcdce1dd00ab8c023c34e4008cd2f..79323ed1e57525c9671cdbcdd549324da41def94 100644 (file)
@@ -1,4 +1,4 @@
-<table>
+<table class="summary-table">
     <tr>
         <td><?=_Verification points?>:</td>
         <td><?=$assP?></td>
@@ -16,8 +16,8 @@
         <td></td>
     </tr>
 <? } ?>
-<table>
-<h2><?=_Verification Points You Received?></h2>
+</table>
+<h2><? if($support) { ?><?=_Verification Points Received by ${username}?><? } else { ?><?=_Verification Points You Received?><? } ?></h2>
 <?=$pointlist?>
-<h2><?=_Verification Points You Issued?></h2>
+<h2><? if($support) { ?><?=_Verification Points Issued by ${username}?><? } else { ?><?=_Verification Points You Issued?><? } ?></h2>
 <?=$madelist?>
diff --git a/static/static/css/cacert.css b/static/static/css/cacert.css
deleted file mode 100644 (file)
index 34db4f1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-.container {
-  margin-bottom: 30px;
-}
-.quest {
-  font-weight: bold;
-}
-.quest:after {
-  content:"\A";
-  white-space:pre;
-}
-.subtext {
-  color: #c0c0c0;
-}
-.tooltip-inner {
-    white-space:pre-wrap;
-}
-.experthidden{
-       display: none;
-}
-div.error-msgs p{
-       padding: 6px;
-}
diff --git a/static/static/css/main.css b/static/static/css/main.css
new file mode 100644 (file)
index 0000000..f8cd072
--- /dev/null
@@ -0,0 +1,25 @@
+.container {
+    margin-bottom: 30px;
+}
+.quest {
+    font-weight: bold;
+}
+.quest:after {
+    content:"\A";
+    white-space:pre;
+}
+.subtext {
+    color: #c0c0c0;
+}
+.tooltip-inner {
+    white-space:pre-wrap;
+}
+.experthidden{
+    display: none;
+}
+div.error-msgs p{
+    padding: 6px;
+}
+.summary-table td{
+    padding: 0 3px;
+}
diff --git a/static/static/default.css b/static/static/default.css
deleted file mode 100644 (file)
index 83e9e01..0000000
+++ /dev/null
@@ -1,830 +0,0 @@
-/***********************************************/
-/* emx_nav_right.css                           */
-/* Use with template Halo_rightNav.html        */
-/***********************************************/
-
-/***********************************************/
-/* HTML tag styles                             */
-/***********************************************/
-
-body {
-       font-family: Arial,sans-serif;
-       color: #333333;
-       line-height: 1.166;
-       margin: 0px;
-       padding: 0px;
-       background: #cccccc;
-/*     url("/siteimages/bg_grad.jpg") fixed;   */
-}
-
-
-/******* hyperlink and anchor tag styles *******/
-
-a:link, a:visited {
-       color: #005fa9;
-       text-decoration: none;
-}
-
-a:hover {
-       text-decoration: underline;
-}
-
-
-/************** header tag styles **************/
-
-h1 {
-       font: bold 120% Arial ,sans-serif;
-       color: #334d55;
-       margin: 10px;
-       padding: 0px;
-}
-
-h2 {
-       font: bold 114% Arial ,sans-serif;
-       color: #006699;
-       margin: 10px;
-       padding: 0px;
-}
-
-h3 {
-       font: bold 100% Arial ,sans-serif;
-       color: #334d55;
-       margin: 0px;
-       padding: 0px;
-}
-
-h3.pointer {
-       cursor: pointer;
-       /* cursor: hand; */
-}
-
-h4 {
-       font: bold 100% Arial ,sans-serif;
-       color: #333333;
-       margin: 0px;
-       padding: 0px;
-}
-
-h5 {
-       font: 100% Arial ,sans-serif;
-       color: #334d55;
-       margin: 0px;
-       padding: 0px;
-}
-
-
-/*************** list tag styles ***************/
-
-ul.menu {
-       list-style: none;
-       margin: 0px 0px 0px 15px;
-       padding-left: 5px;
-       border-left: 1px dotted #000;
-}
-
-ul.top {
-       list-style: none;
-       margin: 0px 0px 0px 15px;
-       padding-left: 5px;
-       border-left: 0px;
-}
-
-ul.no_indent {
-       list-style: none;
-       padding: 0px;
-}
-
-.attach_ul {
-       margin-bottom: 0px;
-}
-
-.attach_ul + ul {
-       margin-top: 0px;
-}
-
-
-/***********************************************/
-/* Layout Divs                                 */
-/***********************************************/
-
-#pagecell1 {
-       position: absolute;
-       top: 2%;
-       left: 2%;
-       right: 2%;
-       width: 96%;
-       background-color: #ffffff;
-}
-
-#tl {
-       position: absolute;
-       top: -1px;
-       left: -1px;
-       margin: 0px;
-       padding: 0px;
-       z-index: 100;
-}
-
-#tr {
-       position: absolute;
-       top: -1px;
-       right: -1px;
-       margin: 0px;
-       padding: 0px;
-       z-index: 100;
-}
-
-#masthead {
-       position: absolute;
-       top: 0px;
-       left: 2%;
-       right: 2%;
-       width: 95.6%;
-}
-
-#pageNav {
-       float: right;
-       width: 178px;
-       padding: 0px;
-       background-color: #F5f7f7;
-       border-left: 1px solid #cccccc;
-       font: small Verdana,sans-serif;
-}
-
-#content {
-       padding: 0px 10px 0px 0px;
-       margin: 0px 178px 0px 0px;
-}
-
-
-/***********************************************/
-/* Component Divs                              */
-/***********************************************/
-#siteName {
-       margin: 0px;
-       padding: 16px 0px 8px 0px;
-       color: #ffffff;
-       font-weight: normal;
-}
-
-
-/************** utility styles *****************/
-
-#utility {
-       font: 75% Verdana,sans-serif;
-       position: absolute;
-       top: 16px;
-       right: 0px;
-       color: #919999;
-}
-
-#utility a {
-       color: #ffffff;
-}
-
-#utility a:hover {
-       text-decoration: underline;
-}
-
-
-/************** pageName styles ****************/
-
-#pageName {
-       padding: 0px 0px 14px 10px;
-       margin: 0px;
-       border-bottom: 1px solid #ccd2d2;
-       z-index: 2;
-}
-
-#pageName h2 {
-       font: bold 175% Arial,sans-serif;
-       color: #000000;
-       margin: 0px;
-       padding: 0px;
-}
-
-/*
-#pageLogo {
-       position: absolute;
-       top: 8px;
-       left: 10px;
-       z-index: 5;
-}
-*/
-
-
-/************* globalNav styles ****************/
-
-#globalNav {
-       position: relative;
-       width: 100%;
-       min-width: 640px;
-       height: 32px;
-       color: #cccccc;
-       padding: 0px;
-       margin: 0px;
-       background-image: url("siteimages/glbnav_background.gif");
-}
-
-#globalNav img {
-       margin-bottom: -4px;
-}
-
-#gnl {
-       position: absolute;
-       top: 0px;
-       left:0px;
-}
-
-#gnr {
-       position: absolute;
-       top: 0px;
-       right:0px;
-}
-
-#globalLink {
-       position: absolute;
-       top: 6px;
-       height: 22px;
-       min-width: 640px;
-       padding: 0px;
-       margin: 0px;
-       left: 10px;
-       z-index: 100;
-}
-
-
-a.glink, a.glink:visited {
-       font-size: small;
-       color: #000000;
-       font-weight: bold;
-       margin: 0px;
-       padding: 2px 5px 4px 5px;
-       border-right: 1px solid #8fb8bc;
-}
-
-a.glink:hover {
-       background-image: url("siteimages/glblnav_selected.gif");
-       text-decoration: none;
-}
-
-.skipLinks {
-       display: none;
-}
-
-
-/************ subglobalNav styles **************/
-
-.subglobalNav {
-       position: absolute;
-       top: 84px;
-       left: 0px;
-       /*width: 100%;*/
-       min-width: 640px;
-       height: 20px;
-       padding: 0px 0px 0px 10px;
-       visibility: hidden;
-       color: #ffffff;
-}
-
-.subglobalNav a:link, .subglobalNav a:visited {
-       font-size: 80%;
-       color: #ffffff;
-}
-
-.subglobalNav a:hover {
-       color: #cccccc;
-}
-
-
-/*************** search styles *****************/
-/*
-#listshow {
-       z-order: 101;
-}
-*/
-
-#search {
-       position: absolute;
-       top: 125px;
-       right: 0px;
-}
-
-#search form {
-       position: absolute;
-       top: 125px;
-       right: 300px;
-}
-#search input {
-       font-size: 11px;
-}
-
-#search1 {
-       position: absolute;
-       top: 85px;
-       right: 300px;
-}
-
-#search2 {
-       position: absolute;
-       top: 100px;
-       right: 300px;
-}
-
-#search3 {
-       position: absolute;
-       top: 85px;
-       right: 240px;
-}
-
-#search4 {
-       position: absolute;
-       top: 100px;
-       right: 226px;
-}
-
-#googlead {
-       position: absolute;
-       top: 5px;
-       right: 0px;
-       z-index: -10;
-}
-
-#search input {
-       font-size: 70%;
-       margin: 0px 0px 0px 10px;
-}
-
-#search a:link, #search a:visited {
-       font-size: 80%;
-       font-weight: bold;
-
-}
-
-#search a:hover {
-       margin: 0px;
-}
-
-
-/************* breadCrumb styles ***************/
-
-#breadCrumb {
-       padding: 5px 0px 5px 10px;
-       font: small Verdana,sans-serif;
-       color: #aaaaaa;
-}
-
-#breadCrumb a {
-       color: #aaaaaa;
-}
-
-#breadCrumb a:hover {
-       color: #005fa9;
-       text-decoration: underline;
-}
-
-
-/************** feature styles *****************/
-
-.feature {
-       padding: 0px 0px 10px 10px;
-       font-size: 80%;
-       min-height: 200px;
-       height: 200px;
-}
-
-.feature {
-       height: auto;
-}
-
-.feature h3 {
-       font: bold 175% Arial,sans-serif;
-       color: #000000;
-       padding: 30px 0px 5px 0px;
-}
-
-.feature img {
-       float: left;
-       padding: 0px 10px 0px 0px;
-}
-
-
-/*************** content styles ******************/
-
-.content {
-       padding: 10px 0px 0px 10px;
-       font-size: 80%;
-       min-height: 450px;
-}
-
-.content h3 {
-       font: bold 125% Arial,sans-serif;
-       color: #000000;
-}
-
-.content a.capsule {
-       font: bold 1em Arial,sans-serif;
-       color: #005FA9;
-       display: block;
-       padding-bottom: 5px;
-}
-
-.content a.capsule:hover {
-       text-decoration: underline;
-}
-
-td.storyLeft {
-       padding-right: 12px;
-}
-
-
-/************** siteInfo styles ****************/
-
-#siteInfo {
-       clear: both;
-       border-top: 1px solid #cccccc;
-       font-size: small;
-       color: #cccccc;
-       padding: 10px 10px 10px 10px;
-}
-
-
-/************ sectionLinks styles **************/
-
-#sectionLinks {
-       margin: 0px;
-       padding: 0px;
-}
-
-#sectionLinks h3 {
-       padding: 10px 0px 2px 10px;
-       border-bottom: 1px solid #cccccc;
-}
-
-#sectionLinks a:link, #sectionLinks a:visited {
-       display: block;
-       border-top: 1px solid #ffffff;
-       border-bottom: 1px solid #cccccc;
-       background-image: url("siteimages/bg_nav.jpg");
-       font-weight: bold;
-       padding: 3px 0px 3px 10px;
-       color: #21536A;
-}
-
-#sectionLinks a:hover {
-       border-top: 1px solid #cccccc;
-       background-color: #DDEEFF;
-       background-image: none;
-       font-weight: bold;
-       text-decoration: none;
-}
-
-
-/************* relatedLinks styles **************/
-
-#pageNav div {
-       margin: 0px;
-       padding: 0px 0px 10px 10px;
-       border-bottom: 1px solid #cccccc;
-}
-
-#pageNav div h3 {
-       padding: 10px 0px 2px 0px;
-}
-
-#pageNav div a {
-       display: block;
-}
-
-/*** hide top menu ***/
-#pageNav > div > ul.menu {
-       padding-left: 0;
-       border-left: none;
-       margin: 0;
-}
-#pageNav > div{
-       padding: 0;
-}
-
-#pageNav > div > h3.pointer {
-       display: none;
-}
-
-/**************** advert styles *****************/
-
-#advert {
-       padding: 10px;
-}
-
-#advert img {
-       display: block;
-}
-
-
-/********************* end **********************/
-.DataTDGrey {
-       background-color: #EFEDED;
-       border-style: inset;
-       border-width: 1px;
-       font-size: 8pt;
-       color: #000000;
-       font-family: Arial, Tahoma, Verdana, Helvetica, sans-serif;
-
-       padding: 1px 5px 1px 5px;
-       border: 1px #CFCFCF solid;
-       border-left: 1px #cfcfcf dotted;
-       border-right: 1px #cfcfcf dotted;
-}
-
-.DataTDNotDotted {
-       background-color: #e2e2e2;
-       border-style: inset;
-       border-width: 1px;
-       font-size: 8pt;
-       color: #000000;
-       font-family: Arial, Tahoma, Verdana, Helvetica, sans-serif;
-
-       background: #ffffff;
-       padding: 1px 5px 1px 5px;
-       border: 1px #CFCFCF solid;
-       border-left: 1px #cfcfcf solid;
-       border-right: 1px #cfcfcf solid;
-}
-
-.DataTDError {
-    border-style: inset;
-    border-width: 1px;
-    font-size: 8pt;
-    color: #ff0000;
-    font-family: Arial, Tahoma, Verdana, Helvetica, sans-serif;
-
-    background: #ffffff;
-    padding: 1px 5px 1px 5px;
-    border: 1px #cfcfcf solid;
-    border-left: 1px #cfcfcf dotted;
-    border-right: 1px #cfcfcf dotted;
-}
-.wrapper {
-       border-collapse: collapse;
-       font-family: verdana, sans-serif;
-       font-size: 11px;
-       margin-left:auto;
-       margin-right:auto;
-       width: 700px;
-}
-
-.wrapper .check{
-       text-align: center;
-}
-.wrapper td.radio input[type=radio]{
-       float: left;
-       width: 13px;
-       margin: 3px;
-}
-.wrapper td.radio span.name{
-       font-weight: bold;
-       padding-bottom: 4px;
-       margin-top: 3px;
-/*     display: inline;*/
-}
-.wrapper td.radio div.addinfo{
-/*     display: inline;*/
-       padding-left: 19px;
-}
-
-.wrapper td.radio div.elements{
-       clear: both;
-       height: 10px;
-}
-
-td.greytxt {
-       color: #cccccc;
-       font-size: smaller;
-       text-align: right;
-       vertical-align: bottom;
-}
-.bold, .primaryemailaddress {
-       font-weight:bold;
-}
-.italic, .deletedemailaddress {
-       font-style:italic;
-}
-.title {
-       background: #e2e2e2;
-       font-weight: bold;
-       padding: 1px 5px 1px 5px;
-       border: 1px solid #cfcfcf;
-       border-bottom: 3px double #cfcfcf;
-       border-top: 1px solid #656565;
-       text-align: center;
-}
-
-.errmsg {
-       font-weight: bold;
-       color: #FF0000;
-}
-
-.ac_menu {
-       border: 1px solid black
-}
-
-.ac_normal {
-       background-color: #ffffff;
-       cursor: pointer;
-}
-
-.ac_highlight {
-       background-color: #3366cc;
-       color: white;
-       cursor: pointer;
-}
-
-.ac_normal .a {
-       font-size: 13px;
-       color: black;
-}
-
-.ac_highlight .a {
-       font-size: 13px;
-}
-
-.ac_normal .d {
-       float: right;
-       font-size: 10px;
-       color: green;
-}
-
-.ac_highlight .d {
-       float: right;
-       font-size: 10px;
-}
-
-
-/************** sponsorInfo styles ****************/
-
-div.sponsorinfo {
-       clear: both;
-       border-top: 1px solid #cccccc;
-       font-size: small;
-       color: #000000;
-       padding: 10px 10px 10px 10px;
-}
-
-img.sponsorlogo {
-       margin-left: 10px;
-       margin-right: 10px;
-       border: 0px none;
-       vertical-align: middle;
-}
-
-
-/************ Newsbox *************/
-
-#lnews {       /* class for the text "Latest News" */
-       font-size: small;
-       font-variant: small-caps;
-}
-
-div.newsbox {
-       border-top: 1px solid #cccccc;
-       color: #101010;
-       padding: 10px 10px 10px 10px;
-}
-
-
-/************ SQL Performance ***********/
-
-div.footerbar {
-       clear: both;
-       border-top: 1px solid #cccccc;
-       font-size: small;
-       color: black;
-       padding: 10px 10px 10px 10px;
-}
-
-
-/************ Honeypot  ***********/
-
-.robotic {
-       display: none;
-}
-
-
-/************  unicode fallbacks ***********/
-
-/* Some embedding of font */
-@font-face {
-       font-family: 'Source Code Pro';
-       src: local('Source Code Pro');
-/*  src: url(/res/fonts/SourceCodePro-Medium.ttf); */
-}
-
-@font-face {
-       font-family: 'Last Resort';
-       src: local('LastResort');
-/*  src: url(/res/fonts/LastResort.ttf); */
-}
-
-.accountdetail {
-       font-family: 'Source Code Pro', 'Lucida Console', 'Arial Unicode MS', monospace, 'Last Resort';
-       font-size: 1.1em;
-}
-
-.accountdetail.fname, .accountdetail .fname {
-}
-
-.accountdetail.mname {
-}
-
-.accountdetail.lname, .accountdetail .lname {
-       font-weight: bold;
-}
-
-.accountdetail.suffix {
-}
-ul.menu.hidden{
-       display: none;
-}
-img{
-       border: 0;
-}
-formMandatory{
-       color: red;
-}
-.experthidden{
-       display:none;   
-}
-.expertoff{
-       display:none;   
-}
-pre{
-       word-wrap: break-word;
-       white-space: pre-wrap;
-}
-
-.dataTable td {
-       background-color: #e2e2e2;
-       border-style: inset;
-       border-width: 1px;
-       font-size: 8pt;
-       color: #000000;
-       font-family: Arial, Tahoma, Verdana, Helvetica, sans-serif;
-
-       background: #ffffff;
-       padding: 1px 5px 1px 5px;
-       border: 1px #cfcfcf solid;
-       border-left: 1px #cfcfcf dotted;
-       border-right: 1px #cfcfcf dotted;
-}
-
-.dataTable td input {
-       width: 98%;
-       margin-left: 1%;
-       margin-right: 1%;
-}
-.dataTable td nobr input {
-       width: auto;
-}
-.centertext {
-       text-align: center;
-}
-.dataTable th {
-       background: #e2e2e2;
-       font-weight: bold;
-       padding: 1px 5px 1px 5px;
-       border: 1px solid #cfcfcf;
-       border-bottom: 3px double #cfcfcf;
-       border-top: 1px solid #656565;
-       text-align: center;
-}
-
-.dataTable input, .dataTable textarea {
-       font-size: 92%;
-}
-
-.dataTable select, .dataTable option {
-       font-size: 92%;
-}
-.dataTable textarea{
-       width: 100%;
-}
-
-pre.string{
-       display: inline;
-}
-
-.loginbox {background:#F5F7F7;border:2px solid #cccccc;margin:0px auto;height:auto;width:300px;padding:1em;text-align:center;}
-.loginbox .smalltext {font-size:10px;}
-.loginbox label {width:100px;display:block;float:left;}
-.loginbox text {width:166px;display:block;float:left;}
-.loginbox br {clear:left;}
-.loginbox h1 {font-size:1.9em;text-align:center;}
-
-
-.domainPinglogFirstCell{
-       width: 15px;
-}
-textarea.csr{
-       width: 400px;
-       height: 400px;
-}
\ No newline at end of file
index 228528b7074cafaa338ef8628603a8f504be739e..44c23535a9bfe5d8c422a754268fe85cbfb63ef3 100644 (file)
@@ -4,13 +4,16 @@ import static org.hamcrest.CoreMatchers.*;
 import static org.junit.Assert.*;
 
 import java.io.IOException;
+import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URLConnection;
+import java.sql.Timestamp;
 import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.cacert.gigi.GigiApiException;
+import org.cacert.gigi.database.GigiPreparedStatement;
 import org.cacert.gigi.dbObjects.EmailAddress;
 import org.cacert.gigi.dbObjects.Group;
 import org.cacert.gigi.dbObjects.ObjectCache;
@@ -20,6 +23,7 @@ import org.cacert.gigi.pages.admin.support.SupportEnterTicketPage;
 import org.cacert.gigi.pages.admin.support.SupportUserDetailsPage;
 import org.cacert.gigi.testUtils.ClientTest;
 import org.cacert.gigi.testUtils.IOUtils;
+import org.cacert.gigi.util.DayDate;
 import org.junit.Test;
 
 public class TestSEAdminPageDetails extends ClientTest {
@@ -78,7 +82,7 @@ public class TestSEAdminPageDetails extends ClientTest {
 
         assertEquals(0, logCountAdmin(id));
         assertEquals(0, logCountUser(clientCookie));
-        // chaniging both leads to 2 entries
+        // changing both leads to 2 entries
         assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=1&dobm=2&doby=2000&detailupdate", 0));
         assertEquals(1, logCountAdmin(id));
         assertEquals(1, logCountUser(clientCookie));
@@ -105,6 +109,49 @@ public class TestSEAdminPageDetails extends ClientTest {
 
     }
 
+    @Test
+    public void testUserDetailsMyPoints() throws MalformedURLException, IOException {
+        String email = createUniqueName() + "@example.com";
+        String fname = "Först";
+        String lname = "Secönd";
+        int id = createVerifiedUser(fname, lname, email, TEST_PASSWORD);
+        String clientCookie = login(email, TEST_PASSWORD);
+
+        // try to open mypoints as user
+        HttpURLConnection uc = get(clientCookie, SupportUserDetailsPage.PATH + id + "/points");
+
+        assertEquals(403, uc.getResponseCode());
+
+        // enter verification and open mypoints as supporter
+
+        makeAssurer(this.id);
+        String location = createUniqueName();
+        try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `when`=? ")) {
+            ps.setInt(1, this.id);
+            ps.setInt(2, User.getById(id).getPreferredName().getId());
+            ps.setInt(3, 10);
+            ps.setString(4, location);
+            ps.setString(5, "2010-01-01");
+            ps.setTimestamp(6, new Timestamp(System.currentTimeMillis() - DayDate.MILLI_DAY * 200));
+            ps.execute();
+        }
+
+        uc = get(cookie, SupportUserDetailsPage.PATH + id + "/points");
+
+        String res = IOUtils.readURL(uc);
+        assertThat(res, containsString("Support User Points"));
+        assertThat(res, containsString(location));
+
+        // remove ticket number and try to access mypoints from supporter
+        // account
+        assertEquals(302, post(cookie, SupportEnterTicketPage.PATH, "deleteTicket=action", 0).getResponseCode());
+
+        uc = get(cookie, SupportUserDetailsPage.PATH + id + "/points");
+
+        assertEquals(403, uc.getResponseCode());
+
+    }
+
     private int logCountAdmin(int id) throws IOException {
         return getLogEntryCount(IOUtils.readURL(get(History.SUPPORT_PATH.replace("*", Integer.toString(id)))));
     }
index 915ede7f75ceaff11b6c7dcd935e54f896095383..136ca610e5b6af7fdff1aaabcd3d7e29266aea8d 100644 (file)
@@ -230,9 +230,9 @@ public class TestAssurance extends ManagedTest {
         execute("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&certify=1&rules=1&assertion=1&points=10");
 
         String cookie = login(assureeM, TEST_PASSWORD);
-        URLConnection url = get(cookie, MyPoints.PATH);
+        URLConnection url = get(cookie, Points.PATH);
         String resp = IOUtils.readURL(url);
-        resp = resp.split(Pattern.quote("</table>"))[0];
+        resp = resp.split(Pattern.quote("</table>"))[1];
         assertThat(resp, containsString(uniqueLoc));
     }
 
@@ -241,9 +241,9 @@ public class TestAssurance extends ManagedTest {
         String uniqueLoc = createUniqueName();
         executeSuccess("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&certify=1&rules=1&assertion=1&points=10");
         String cookie = login(assurerM, TEST_PASSWORD);
-        URLConnection url = get(cookie, MyPoints.PATH);
+        URLConnection url = get(cookie, Points.PATH);
         String resp = IOUtils.readURL(url);
-        resp = resp.split(Pattern.quote("</table>"))[1];
+        resp = resp.split(Pattern.quote("</table>"))[2];
         assertThat(resp, containsString(uniqueLoc));
     }