Requests for FTP access
[bpt/portal.git] / sec.mlt
diff --git a/sec.mlt b/sec.mlt
index b8c863c..9e5c0dd 100644 (file)
--- a/sec.mlt
+++ b/sec.mlt
@@ -8,6 +8,7 @@ val uname = case $"uname" of
 val socks = Sec.socketPerms uname;
 val tpe = Sec.isTpe uname;
 val cron = Sec.cronAllowed uname;
+val ftp = Sec.ftpAllowed uname;
 
 ref showNormal = true;
 
@@ -50,6 +51,19 @@ elseif $"cmd" = "cron2" then
        end
        %><h3><b>Request added</b></h3><%
 
+elseif $"cmd" = "ftp" then
+       showNormal := false;
+       val ftp = iff $"ftp" = "yes" then "enabled" else "disabled";
+       %>Are you sure you want to request that FTP permissions for <b><% Web.html uname %></b> be <b><% ftp %></b>?<br>
+       <a href="sec?cmd=ftp2&uname=<% Web.urlEncode uname %>&ftp=<% ftp %>&msg=<% Web.urlEncode ($"msg") %>">Yes, place the request!</a><%
+elseif $"cmd" = "ftp2" then
+       val ftp = iff $"ftp" = "enabled" then "enable" else "disable";
+       val id = Sec.Req.add (you, String.concat [uname, ": ", ftp, " FTP access"], $"msg");
+       if not (Sec.Req.notifyNew id) then
+               %><h3><b>Error sending e-mail notification</b></h3><%
+       end
+       %><h3><b>Request added</b></h3><%
+
 elseif $"cmd" = "rule" then
        showNormal := false;
        val rule = $"rule";
@@ -246,6 +260,21 @@ if showNormal then %>
 </table>
 </form>
 
+<h3><b>Request change to your FTP permissions</b></h3>
+
+<form action="sec" method="post">
+<input type="hidden" name="uname" value="<% uname %>">
+<input type="hidden" name="cmd" value="ftp">
+<table>
+<tr> <td align="right"><b>Allowed to use FTP?</b></td> <td><select name="ftp">
+       <option value="no"<% if not ftp then %> selected<% end %>>No</option>
+       <option value="yes"<% if ftp then %> selected<% end %>>Yes</option>
+</select></td> </tr>
+<tr> <td align="right" valign="top"><b>Reason:</b></td> <td><textarea name="msg" wrap="soft" rows="3" cols="80"></textarea></td> </tr>
+<tr> <td><input type="submit" value="Request"></td> </tr>
+</table>
+</form>
+
 <% val rules = Sec.findFirewallRules uname;
 switch rules of
   _::_ => %>