From: Felix Dörre Date: Fri, 5 Aug 2016 20:12:11 +0000 (+0200) Subject: Merge changes I8f2dfb5e,Ife185cda,I79a10fa7,Ib764cc42,I76efe755, ... X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=a32ac88a108c3e48ee082bf278440ccd1a1c63f9;hp=9994af5b2aee70810acd1e4675c7a7c4a538a961 Merge changes I8f2dfb5e,Ife185cda,I79a10fa7,Ib764cc42,I76efe755, ... * 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 --- diff --git a/src/org/cacert/gigi/Gigi.java b/src/org/cacert/gigi/Gigi.java index 9e111ae7..1c503666 100644 --- a/src/org/cacert/gigi/Gigi.java +++ b/src/org/cacert/gigi/Gigi.java @@ -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); diff --git a/src/org/cacert/gigi/Gigi.templ b/src/org/cacert/gigi/Gigi.templ index 9884721a..3c011941 100644 --- a/src/org/cacert/gigi/Gigi.templ +++ b/src/org/cacert/gigi/Gigi.templ @@ -10,7 +10,7 @@ - + diff --git a/src/org/cacert/gigi/output/AssurancesDisplay.java b/src/org/cacert/gigi/output/AssurancesDisplay.java index 8f0e6cab..f6d5362a 100644 --- a/src/org/cacert/gigi/output/AssurancesDisplay.java +++ b/src/org/cacert/gigi/output/AssurancesDisplay.java @@ -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); } diff --git a/src/org/cacert/gigi/output/AssurancesDisplay.templ b/src/org/cacert/gigi/output/AssurancesDisplay.templ index 1a552f06..a36e3583 100644 --- a/src/org/cacert/gigi/output/AssurancesDisplay.templ +++ b/src/org/cacert/gigi/output/AssurancesDisplay.templ @@ -13,7 +13,11 @@ + + + + diff --git a/src/org/cacert/gigi/pages/admin/support/SupportUserDetailsForm.templ b/src/org/cacert/gigi/pages/admin/support/SupportUserDetailsForm.templ index 08ea7597..b73cc6da 100644 --- a/src/org/cacert/gigi/pages/admin/support/SupportUserDetailsForm.templ +++ b/src/org/cacert/gigi/pages/admin/support/SupportUserDetailsForm.templ @@ -32,9 +32,9 @@ - + : - + () : diff --git a/src/org/cacert/gigi/pages/wot/MyPoints.java b/src/org/cacert/gigi/pages/wot/MyPoints.java deleted file mode 100644 index 69f5d7e6..00000000 --- a/src/org/cacert/gigi/pages/wot/MyPoints.java +++ /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 vars = new HashMap(); - 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 index 00000000..45387352 --- /dev/null +++ b/src/org/cacert/gigi/pages/wot/Points.java @@ -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 vars = new HashMap(); + 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; + } + } + +} diff --git a/src/org/cacert/gigi/pages/wot/MyPoints.templ b/src/org/cacert/gigi/pages/wot/Points.templ similarity index 60% rename from src/org/cacert/gigi/pages/wot/MyPoints.templ rename to src/org/cacert/gigi/pages/wot/Points.templ index 1671f1ad..79323ed1 100644 --- a/src/org/cacert/gigi/pages/wot/MyPoints.templ +++ b/src/org/cacert/gigi/pages/wot/Points.templ @@ -1,4 +1,4 @@ - +
@@ -16,8 +16,8 @@ -
:
-

+
+

-

+

diff --git a/static/static/css/cacert.css b/static/static/css/cacert.css deleted file mode 100644 index 34db4f10..00000000 --- a/static/static/css/cacert.css +++ /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 index 00000000..f8cd0729 --- /dev/null +++ b/static/static/css/main.css @@ -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 index 83e9e01d..00000000 --- a/static/static/default.css +++ /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 diff --git a/tests/org/cacert/gigi/pages/admin/TestSEAdminPageDetails.java b/tests/org/cacert/gigi/pages/admin/TestSEAdminPageDetails.java index 228528b7..44c23535 100644 --- a/tests/org/cacert/gigi/pages/admin/TestSEAdminPageDetails.java +++ b/tests/org/cacert/gigi/pages/admin/TestSEAdminPageDetails.java @@ -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))))); } diff --git a/tests/org/cacert/gigi/pages/wot/TestAssurance.java b/tests/org/cacert/gigi/pages/wot/TestAssurance.java index 915ede7f..136ca610 100644 --- a/tests/org/cacert/gigi/pages/wot/TestAssurance.java +++ b/tests/org/cacert/gigi/pages/wot/TestAssurance.java @@ -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(""))[0]; + resp = resp.split(Pattern.quote(""))[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(""))[1]; + resp = resp.split(Pattern.quote(""))[2]; assertThat(resp, containsString(uniqueLoc)); }