- public static Data row(List<String> row) {
- Data data = new Data();
- data.user = row.get(1);
- data.role = row.get(2);
- data.ns = row.get(3);
- data.rname = row.get(4);
- data.expires = new Date(Long.parseLong(row.get(6)));
- return data;
- }
-
- public static void batchDelete(StringBuilder sb, List<String> row) {
- sb.append("DELETE from authz.user_role WHERE user='");
- sb.append(row.get(1));
- sb.append("' AND role='");
- sb.append(row.get(2));
- sb.append("';\n");
- }
-
- public static void batchExtend(StringBuilder sb, List<String> row, String newDate ) {
- sb.append("UPDATE authz.user_role SET expires='");
- sb.append(newDate);
- sb.append("' WHERE user='");
- sb.append(row.get(1));
- sb.append("' AND role='");
- sb.append(row.get(2));
- sb.append("';\n");
+ public void batchUpdateExpires(StringBuilder sb) {
+ sb.append("UPDATE authz.user_role SET expires='");
+ sb.append(Chrono.dateTime(expires()));
+ sb.append("' WHERE user='");
+ sb.append(user());
+ sb.append("' AND role='");
+ sb.append(role());
+ sb.append("';\n");
+ }
+
+ public static String histMemo(String fmt, List<String> row) {
+ String reason;
+ if(row.size()>7) { // Reason included
+ reason = String.format("%s removed from %s because %s",
+ row.get(1),row.get(2),row.get(7));
+ } else {
+ reason = String.format(fmt, row.get(1),row.get(2), row.get(5));
+ }
+ return reason;
+ }
+
+ public static String histSubject(List<String> row) {
+ return row.get(1) + '|' + row.get(2);
+ }
+
+ public static void clear() {
+ data.clear();
+ byUser.clear();
+ byRole.clear();
+ cache.resetLocalData();
+