IP address requesting (untested because of fyodor outage)
authoradamch <adamch>
Sun, 11 Nov 2007 19:42:35 +0000 (19:42 +0000)
committeradamch <adamch>
Sun, 11 Nov 2007 19:42:35 +0000 (19:42 +0000)
granter_usual.sh [new file with mode: 0755]
ip.mlt [new file with mode: 0644]
ip.sml [new file with mode: 0644]
remind/remind.sml
tables.sql
vmailpasswd/pass.sml

diff --git a/granter_usual.sh b/granter_usual.sh
new file mode 100755 (executable)
index 0000000..3fc24f6
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+./granter.sh www-data >grant.tmp
+psql -f grant.tmp hcoop_hcoop
+rm grant.tmp
diff --git a/ip.mlt b/ip.mlt
new file mode 100644 (file)
index 0000000..b34929f
--- /dev/null
+++ b/ip.mlt
@@ -0,0 +1,148 @@
+<% @header [("title", ["IP address requests"])];
+
+val admin = Group.inGroupName "server";
+
+val nodeNum = case $"node" of
+                 "" => 2
+               | node => Web.stoi node;
+
+if $"new" <> "" then
+       val port = Web.stoi ($"port");
+       val msg = $"msg";
+
+       %>Are you sure you want to ask for an IP address with port <% port %> free on machine <% Init.nodeName nodeNum %>?<br><br>
+       <a href="ip?node=<% nodeNum %>&req=<% port %>&msg=<% Web.urlEncode msg %>">Yes, I want to request that.</a>
+
+<% elseif $"req" <> "" then
+       val id = Ip.add {usr = Init.getUserId(), node = nodeNum, data = $"req", msg = $"msg"};
+       if not (Ip.notifyNew id) then
+               %><h3>Error sending e-mail notification</h3><%
+       end
+       %><h3>Request added</h3><%
+
+elseif $"cmd" = "open" then
+       %><h3>Open requests</h3>
+       <a href="ip?cmd=list">List all requests</a><%
+
+       foreach (name, req) in Ip.listOpen () do %>
+<br><hr><br>
+<table class="blanks">
+<tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
+<tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
+<tr> <td>Node:</td> <td><% Web.html (Init.nodeName (#node req)) %></td> </tr>
+<tr> <td>Port:</td> <td><% #data req %></td> </tr>
+<tr> <td>Reason:</td> <td><% Web.html (#msg req) %></td> </tr>
+</table>
+
+<% if admin then %>
+       <br>
+       <a href="ip?mod=<% #id req %>">[Modify]</a>
+       <a href="ip?del=<% #id req %>">[Delete]</a><br>
+       To install, run: <i>tell adamc what text to put here</i>.
+<% end %>
+
+<%     end
+
+elseif $"cmd" = "list" then
+       %><h3>All requests</h3><%
+
+       foreach (name, req) in Ip.list () do %>
+<br><hr><br>
+<table class="blanks">
+<tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
+<tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
+<tr> <td>Node:</td> <td><% Web.html (Init.nodeName (#node req)) %></td> </tr>
+<tr> <td>Port:</td> <td><% #data req %></td> </tr>
+<tr> <td>Reason:</td> <td><% Web.html (#msg req) %></td> </tr>
+</table>
+
+<% if admin then %>
+       <br>
+       <a href="ip?mod=<% #id req %>">[Modify]</a>
+       <a href="ip?del=<% #id req %>">[Delete]</a>
+<% end %>
+
+<%     end
+
+elseif $"mod" <> "" then
+       Group.requireGroupName "server";
+       val id = Web.stoi ($"mod");
+       val req = Ip.lookup id;
+       val user = Init.lookupUser (#usr req) %>
+<h3>Handle request</h3>
+
+<form method="post">
+<input type="hidden" name="save" value="<% id %>">
+<table class="blanks">
+<tr> <td>Requestor:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr>
+<tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
+<tr> <td>Node:</td> <td><select name="node">
+<% foreach node in Init.listNodes () do %>
+       <option value="<% #id node %>"<% if #id node = #node req then %> selected<% end %>><% Web.html (#name node) %> (<% Web.html (#descr node) %>; Debian <% Web.html (#debian node) %>)</option>
+<% end %>
+</select>
+<tr> <td>Status:</td> <td><select name="status">
+       <option value="0"<% if #status req = Ip.NEW then %> selected<% end %>>New</option>
+       <option value="1"<% if #status req = Ip.INSTALLED then %> selected<% end %>>Installed</option>
+       <option value="2"<% if #status req = Ip.REJECTED then %> selected<% end %>>Rejected</option>
+</select></td> </tr>
+<tr> <td>Port:</td> <td><input name="port" size="6" value="<% Web.html (#data req) %>"></td> </tr>
+<tr> <td>Message:</td> <td><textarea name="msg" rows="10" cols="80" wrap="soft"><% Web.html (#msg req) %></textarea></td> </tr>
+<tr> <td><input type="submit" value="Save"></td> </tr>
+</table>
+</form>
+
+<% elseif $"save" <> "" then
+       Group.requireGroupName "server";
+       val id = Web.stoi ($"save");
+       val node = Web.stoi ($"node");
+       val req = Ip.lookup id;
+       val oldStatus = #status req;
+       val newStatus = Ip.statusFromInt (Web.stoi ($"status"));
+       Ip.modify {req with node = node, data = $"port", msg = $"msg", status = newStatus};
+       if oldStatus <> newStatus then
+               if not (Ip.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then
+                       %><h3>Error sending e-mail notification</h3><%
+               end
+       end
+       %><h3>Request modified</h3>
+       Back to: <a href="ip?cmd=open">open requests</a>, <a href="ip?cmd=list">all requests</a>
+
+<% elseif $"del" <> "" then
+       Group.requireGroupName "server";
+       val id = Web.stoi ($"del");
+       val req = Ip.lookup id;
+       val user = Init.lookupUser (#usr req)
+       %><h3>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</h3>
+       <a href="ip?del2=<% id %>">Yes, I'm sure!</a>
+
+<% elseif $"del2" <> "" then
+       Group.requireGroupName "server";
+       val id = Web.stoi ($"del2");
+       Ip.delete id
+       %><h3>Request deleted</b><h3>
+       Back to: <a href="ip?cmd=open">open requests</a>, <a href="ip?cmd=list">all requests</a>
+
+<% else %>
+
+<h3>Request an IP address</h3>
+
+<p>Use this form to request use of a particular port.  If your request is granted, you will be assigned rights to your port on a particular IP address.  The most common use of this form is to ask for an IP address to use with an SSL virtual web host.  We will grant requests in very few other cases.  Try to use free ports on the base IP address of one of the machines on which we grant member log-in.</p>
+
+<form method="post">
+<input type="hidden" name="new" value="1">
+<table class="blanks">
+<tr> <td>Machine:</td> <td><select name="node">
+<% foreach node in Init.listNodes () do %>
+       <option value="<% #id node %>"<% if #id node = nodeNum then %> selected<% end %>><% Web.html (#name node) %> (<% Web.html (#descr node) %>; Debian <% Web.html (#debian node) %>)</option>
+<% end %>
+</select></td></tr>
+<tr> <td>Port#:</td> <td><input name="port" size="6" value="443"></td> </tr>
+<tr> <td>Reason:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
+<tr> <td><input type="submit" value="Request"></td> </tr>
+</table>
+</form>
+
+<% end %>
+
+<% @footer[] %>
\ No newline at end of file
diff --git a/ip.sml b/ip.sml
new file mode 100644 (file)
index 0000000..447834a
--- /dev/null
+++ b/ip.sml
@@ -0,0 +1,12 @@
+structure Ip = RequestH(struct
+                       val table = "Ip"
+                       val adminGroup = "server"
+                       fun subject _ = "IP address request"
+                       val template = "ip"
+                       val descr = "IP address"
+
+                       fun body {node, mail, data = port} =
+                           (Mail.mwrite (mail, " IP address for port: ");
+                            Mail.mwrite (mail, port);
+                            Mail.mwrite (mail, "\n"))
+                       end)
index 32bf3c9..01d0982 100644 (file)
@@ -74,6 +74,16 @@ fun main _ =
                        write "To make a payment, visit:\n";
                        write "     https://members2.hcoop.net/\n";
                        write "and use the PayPal or Google Checkout link.\n";
+
+                       write "\nIf you don't know how to get a username and password for members2.hcoop.net, visit:\n";
+                       write "     http://wiki2.hcoop.net/MemberManual/MigrationGuide\n";
+                       write "for a reminder.  (\"Step 1\" is all you need to read.)\n";
+
+                       write "\nIf for whatever reason you don't plan to pay the amount suggested in this e-mail,\n";
+                       write "_please_ don't stay silent.  Reply to this message explaining your circumstances.\n";
+                       write "We are doing limited-time monetary grants on request, due to the extra costs\n";
+                       write "associated with setting up our new servers.\n";
+
                        ignore (Mail.mclose m)
                    end
            end
index ea3633c..1960b2b 100644 (file)
@@ -314,3 +314,17 @@ CREATE TABLE Sec(
        FOREIGN KEY (node) REFERENCES WebNode(id) ON DELETE CASCADE);
 
 CREATE SEQUENCE SecSeq START 1;
+
+CREATE TABLE Ip(
+       id INTEGER PRIMARY KEY,
+       usr INTEGER NOT NULL,
+       node INTEGER NOT NULL,
+       data TEXT NOT NULL,
+       msg TEXT NOT NULL,
+       status INTEGER NOT NULL,
+       stamp TIMESTAMP NOT NULL,
+       cstamp TIMESTAMP,
+       FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE,
+       FOREIGN KEY (node) REFERENCES WebNode(id) ON DELETE CASCADE);
+
+CREATE SEQUENCE IpSeq START 1;
index fc0a595..fbbf26f 100644 (file)
@@ -14,7 +14,7 @@ fun change (email, old, new) =
                                 String.toString old,
                                 "\" \"",
                                 String.toString new,
-                                "\" >/tmp/pass1 2>/tmp/pass2"]
+                                "\" >/dev/null 2>/dev/null"]
     in
        OS.Process.isSuccess (OS.Process.system cmd)
     end