import org.cacert.gigi.pages.Verify;
import org.cacert.gigi.pages.account.ChangePasswordPage;
import org.cacert.gigi.pages.account.MyDetails;
-import org.cacert.gigi.pages.account.UserHistory;
+import org.cacert.gigi.pages.account.History;
import org.cacert.gigi.pages.account.UserTrainings;
import org.cacert.gigi.pages.account.certs.CertificateAdd;
import org.cacert.gigi.pages.account.certs.Certificates;
putPage(FindDomainPage.PATH, new FindDomainPage("Find Domain"), "Support Console");
putPage(SupportUserDetailsPage.PATH + "*", new SupportUserDetailsPage("Support: User Details"), null);
- putPage(UserHistory.PATH, new UserHistory(false), "My Account");
- putPage(UserHistory.SUPPORT_PATH, new UserHistory(true), null);
+ putPage(History.PATH, new History(false), "My Account");
+ putPage(History.SUPPORT_PATH, new History(true), null);
putPage(UserTrainings.PATH, new UserTrainings(false), "My Account");
putPage(UserTrainings.SUPPORT_PATH, new UserTrainings(true), null);
if (testing) {
package org.cacert.gigi.dbObjects;
import java.util.LinkedList;
+import java.util.List;
import org.cacert.gigi.database.DatabaseConnection;
import org.cacert.gigi.database.GigiPreparedStatement;
myCache.remove(this);
}
+ public String[] getAdminLog() {
+ GigiPreparedStatement prep = DatabaseConnection.getInstance().prepare("SELECT `when`, type, information FROM `adminLog` WHERE uid=? ORDER BY `when` ASC");
+ prep.setInt(1, getId());
+ GigiResultSet res = prep.executeQuery();
+ List<String> entries = new LinkedList<String>();
+
+ while (res.next()) {
+ entries.add(res.getString(2) + " (" + res.getString(3) + ")");
+ }
+
+ return entries.toArray(new String[0]);
+ }
+
}
return false;
}
- public String[] getAdminLog() {
- GigiPreparedStatement prep = DatabaseConnection.getInstance().prepare("SELECT `when`, type, information FROM `adminLog` WHERE uid=? ORDER BY `when` ASC");
- prep.setInt(1, getId());
- GigiResultSet res = prep.executeQuery();
- List<String> entries = new LinkedList<String>();
-
- while (res.next()) {
- entries.add(res.getString(2) + " (" + res.getString(3) + ")");
- }
-
- return entries.toArray(new String[0]);
- }
-
public String[] getTrainings() {
GigiPreparedStatement prep = DatabaseConnection.getInstance().prepare("SELECT `pass_date`, `type_text` FROM `cats_passed` LEFT JOIN `cats_type` ON `cats_type`.`id`=`cats_passed`.`variant_id` WHERE `user_id`=? ORDER BY `pass_date` ASC");
prep.setInt(1, getId());
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.cacert.gigi.dbObjects.CertificateOwner;
import org.cacert.gigi.dbObjects.User;
import org.cacert.gigi.output.template.OutputableArrayIterable;
+import org.cacert.gigi.pages.LoginPage;
import org.cacert.gigi.pages.Page;
import org.cacert.gigi.util.AuthorizationContext;
-public class UserHistory extends Page {
+public class History extends Page {
public static final String SUPPORT_PATH = "/support/user/*/history";
private boolean support;
- public UserHistory(boolean support) {
- super(support ? "Support user history" : "History");
+ public History(boolean support) {
+ super(support ? "Support History" : "History");
this.support = support;
}
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- User u;
+ CertificateOwner u;
if (support) {
String info = req.getPathInfo();
int id = Integer.parseInt(info.substring(intStart, info.length() - SUPPORT_PATH.length() + intStart + 1));
return;
}
} else {
- u = getUser(req);
+ u = LoginPage.getAuthorizationContext(req).getTarget();
}
String[] adminLog = u.getAdminLog();
HashMap<String, Object> vars = new HashMap<>();
import org.cacert.gigi.dbObjects.Group;
import org.cacert.gigi.pages.account.MyDetails;
-import org.cacert.gigi.pages.account.UserHistory;
+import org.cacert.gigi.pages.account.History;
import org.cacert.gigi.pages.admin.support.SupportEnterTicketPage;
import org.cacert.gigi.pages.admin.support.SupportUserDetailsPage;
import org.cacert.gigi.testUtils.ClientTest;
}
private int logCountAdmin(int id) throws IOException {
- return getLogEntryCount(IOUtils.readURL(get(UserHistory.SUPPORT_PATH.replace("*", Integer.toString(id)))));
+ return getLogEntryCount(IOUtils.readURL(get(History.SUPPORT_PATH.replace("*", Integer.toString(id)))));
}
private int logCountUser(String cookie) throws IOException {
- return getLogEntryCount(IOUtils.readURL(get(cookie, UserHistory.PATH)));
+ return getLogEntryCount(IOUtils.readURL(get(cookie, History.PATH)));
}
private int getLogEntryCount(String readURL) {