% val you = Init.getUserId ();
val yourname = Init.getUserName ();
val uname = case $"uname" of
"" => yourname
| uname => uname;
val socks = Sec.socketPerms uname;
val tpe = Sec.isTpe uname;
val cron = Sec.cronAllowed uname;
ref showNormal = true;
@header [("title", ["Security settings"])];
if $"cmd" = "socks" then
showNormal := false;
val socks = $"socks";
%>Are you sure you want to request that socket permissions for <% Web.html uname %> be changed to <% Web.html socks %>? ">Yes, place the request!<%
elseif $"cmd" = "socks2" then
val id = Sec.Req.add (you, String.concat [uname, ": change socket permissions to ", $"socks"], $"msg");
if not (Sec.Req.notifyNew id) then
%>
Error sending e-mail notification
<%
end
%>
Request added
<%
elseif $"cmd" = "tpe" then
showNormal := false;
val tpe = iff $"tpe" = "yes" then "on" else "off";
%>Are you sure you want to request that trusted-path-executables-only for <% Web.html uname %> be turned <% tpe %>? ">Yes, place the request!<%
elseif $"cmd" = "tpe2" then
val id = Sec.Req.add (you, String.concat [uname, ": turn tpe ", $"tpe"], $"msg");
if not (Sec.Req.notifyNew id) then
%>
Error sending e-mail notification
<%
end
%>
Request added
<%
elseif $"cmd" = "cron" then
showNormal := false;
val cron = iff $"cron" = "yes" then "enabled" else "disabled";
%>Are you sure you want to request that cron permissions for <% Web.html uname %> be <% cron %>? ">Yes, place the request!<%
elseif $"cmd" = "cron2" then
val cron = iff $"cron" = "enabled" then "enable" else "disable";
val id = Sec.Req.add (you, String.concat [uname, ": ", cron, " cron access"], $"msg");
if not (Sec.Req.notifyNew id) then
%>
Error sending e-mail notification
<%
end
%>
Request added
<%
elseif $"cmd" = "rule" then
showNormal := false;
val rule = $"rule";
%>Are you sure you want to request the firewall rule <% Web.html uname %> <% Web.html rule %>? ">Yes, place the request!<%
elseif $"cmd" = "rule2" then
val id = Sec.Req.add (you, String.concat ["Add firewall rule \"", uname, " ", $"rule", "\""], $"msg");
if not (Sec.Req.notifyNew id) then
%>
Error sending e-mail notification
<%
end
%>
Request added
<%
elseif $"modRule" <> "" then
showNormal := false;
val oldRule = $"modRule";
val rule = $"rule"
if oldRule = rule then
%>You didn't modify the textbox for this rule before clicking the button, so there is no request to be made.<%
else
%>Are you sure you want to request that firewall rule <% Web.html uname %> <% Web.html oldRule %> be replaced by <% Web.html uname %> <% Web.html rule %>? ">Yes, place the request!<%
end
elseif $"modRule2" <> "" then
val id = Sec.Req.add (you, String.concat ["Change firewall rule \"", uname, " ", $"modRule2", "\" to \"", uname, " ", $"rule", "\""], $"msg");
if not (Sec.Req.notifyNew id) then
%>
Error sending e-mail notification
<%
end
%>
Request added
<%
elseif $"delRule" <> "" then
showNormal := false;
val oldRule = $"delRule";
%>Are you sure you want to request that firewall rule <% Web.html uname %> <% Web.html oldRule %> be deleted? ">Yes, place the request!<%
elseif $"delRule2" <> "" then
val id = Sec.Req.add (you, String.concat ["Delete firewall rule \"", uname, " ", $"delRule2", "\""], $"msg");
if not (Sec.Req.notifyNew id) then
%>
[Modify][Delete]
<% end
elseif $"mod" <> "" then
showNormal := false;
Group.requireGroupName "server";
val id = Web.stoi ($"mod");
val req = Sec.Req.lookup id;
val user = Init.lookupUser (#usr req) %>
Handle request
<% elseif $"save" <> "" then
showNormal := false;
Group.requireGroupName "server";
val id = Web.stoi ($"save");
val req = Sec.Req.lookup id;
val oldStatus = #status req;
val newStatus = Sec.Req.statusFromInt (Web.stoi ($"status"));
Sec.Req.modify {req with data = $"req", msg = $"msg", status = newStatus};
if oldStatus <> newStatus then
if not (Sec.Req.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
%>
Error sending e-mail notification
<%
end
end
%>
Request modified
Back to: open requests, all requests
<% elseif $"del" <> "" then
showNormal := false;
Group.requireGroupName "server";
val id = Web.stoi ($"del");
val req = Sec.Req.lookup id;
val user = Init.lookupUser (#usr req)
%>
Are you sure you want to delete request by <% #name user %> for "<% #data req %>"?
Yes, I'm sure!
<% elseif $"del2" <> "" then
showNormal := false;
Group.requireGroupName "server";
val id = Web.stoi ($"del2");
Sec.Req.delete id
%>