1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
<% local view, viewlibrary, page_info, session = ... %>
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
}
</script>
<script type="text/javascript">
if (typeof $.tablesorter == 'undefined') {
document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>');
}
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#pending").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
$("#approved").tablesorter({headers: {0:{sorter: false}, 5:{sorter:'usLongDate'}}, widgets: ['zebra']});
$("#revoked").tablesorter({headers: {0:{sorter: false}, 5:{sorter:'usLongDate'}}, widgets: ['zebra']});
});
</script>
<% htmlviewfunctions.displaycommandresults({"approve", "deleterequest", "deletemyrequest", "renewcert", "requestrenewcert", "revoke", "deletecert"}, session) %>
<%
local label = ""
if view.value.user then
label = label.." for "..html.html_escape(view.value.user.value)
end
local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Pending certificate requests"..label}), page_info)
%>
<% if not view.value.pending or #view.value.pending.value == 0 then %>
<p>No certificates pending</p>
<% else %>
<table id="pending" class="tablesorter">
<thead>
<tr>
<th>Action</th>
<th>User</th>
<th>Cert Type</th>
<th>Common Name</th>
</tr>
</thead>
<tbody>
<% local req = cfe({ type="hidden", value="" }) %>
<% for i,request in ipairs(view.value.pending.value) do %>
<tr>
<td>
<%
req.value = request.request
if viewlibrary.check_permission("viewrequest") then
htmlviewfunctions.displayitem(cfe({type="link", value={request=req}, label="", option="View", action="viewrequest"}), page_info, -1)
end
if viewlibrary.check_permission("approve") then
htmlviewfunctions.displayitem(cfe({type="form", value={request=req}, label="", option="Approve", action="approve"}), page_info, -1)
end
if viewlibrary.check_permission("deleterequest") then
htmlviewfunctions.displayitem(cfe({type="form", value={request=req}, label="", option="Delete", action="deleterequest"}), page_info, -1)
elseif viewlibrary.check_permission("deletemyrequest") then
htmlviewfunctions.displayitem(cfe({type="form", value={request=req}, label="", option="Delete", action="deletemyrequest"}), page_info, -1)
end
%>
</td>
<td><%= html.html_escape(request.user) %></td>
<td><%= html.html_escape(request.certtype) %></td>
<td><%= html.html_escape(request.commonName) %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% htmlviewfunctions.displaysectionend(header_level) %>
<% viewtype = cfe({type="hidden", value="stream"}) %>
<% local reverserevoked = {}
local approved = {}
local revoked = {}
if view.value.revoked and #view.value.revoked.value > 0 then
for i,serial in ipairs(view.value.revoked.value) do
reverserevoked[serial] = i
end
for i,cert in ipairs(view.value.approved.value) do
if reverserevoked[cert.serial] then
revoked[#revoked + 1] = cert
else
approved[#approved + 1] = cert
end
end
else
approved = view.value.approved.value
end %>
<% htmlviewfunctions.displaysectionstart(cfe({label="Approved certificate requests"..label}), page_info, header_level) %>
<% if #approved == 0 then %>
<p>No certificates approved</p>
<% else %>
<table id="approved" class="tablesorter">
<thead>
<tr>
<th>Action</th>
<th>User</th>
<th>Cert Type</th>
<th>Common Name</th>
<th>Serial Num</th>
<th>End Date</th>
</tr>
</thead>
<tbody>
<% local crt = cfe({ type="hidden", value="" }) %>
<% for i,cert in ipairs(approved) do %>
<tr <% if cert.daysremaining < 14 then %>class='error'<% end %>>
<td>
<%
crt.value = cert.cert
if viewlibrary.check_permission("viewcert") then
htmlviewfunctions.displayitem(cfe({type="link", value={cert=crt}, label="", option="View", action="viewcert"}), page_info, -1)
end
if viewlibrary.check_permission("getcert") then
htmlviewfunctions.displayitem(cfe({type="link", value={cert=crt, viewtype=viewtype}, label="", option="Download", action="getcert"}), page_info, -1)
end
if viewlibrary.check_permission("renewcert") then
htmlviewfunctions.displayitem(cfe({type="form", value={cert=crt}, label="", option="Renew", action="renewcert"}), page_info, -1)
elseif viewlibrary.check_permission("requestrenewcert") then
htmlviewfunctions.displayitem(cfe({type="form", value={cert=crt}, label="", option="Renew", action="requestrenewcert"}), page_info, -1)
end
if viewlibrary.check_permission("revoke") then
htmlviewfunctions.displayitem(cfe({type="form", value={cert=crt}, label="", option="Revoke", action="revoke"}), page_info, -1)
end
if viewlibrary.check_permission("deletecert") then
htmlviewfunctions.displayitem(cfe({type="form", value={cert=crt}, label="", option="Delete", action="deletecert"}), page_info, -1)
end
%>
</td>
<td><%= html.html_escape(cert.user) %></td>
<td><%= html.html_escape(cert.certtype) %></td>
<td><%= html.html_escape(cert.commonName) %></td>
<td><%= html.html_escape(tostring(tonumber('0x'..cert.serial))) %></td>
<td><%= html.html_escape(cert.enddate) %></td>
</tr>
<% end %>
<tbody>
</table>
<% end %>
<% htmlviewfunctions.displaysectionend(header_level) %>
<% htmlviewfunctions.displaysectionstart(cfe({label="Revoked certificates"..label}), page_info, header_level) %>
<% if #revoked == 0 then %>
<p>No certificates revoked</p>
<% else %>
<table id="revoked" class="tablesorter">
<thead>
<tr>
<th>Action</th>
<th>User</th>
<th>Cert Type</th>
<th>Common Name</th>
<th>Serial Num</th>
</tr>
</thead>
<tbody>
<% local crt = cfe({ type="hidden", value="" }) %>
<% for i,cert in ipairs(revoked) do %>
<tr>
<td>
<%
crt.value = cert.cert
if viewlibrary.check_permission("viewcert") then
htmlviewfunctions.displayitem(cfe({type="link", value={cert=crt}, label="", option="View", action="viewcert"}), page_info, -1)
end
--[[ if viewlibrary.check_permission("getcert") then
htmlviewfunctions.displayitem(cfe({type="link", value={cert=crt, viewtype=viewtype}, label="", option="Download", action="getcert"}), page_info, -1)
end --]]
if viewlibrary.check_permission("deletecert") then
htmlviewfunctions.displayitem(cfe({type="form", value={cert=crt}, label="", option="Delete", action="deletecert"}), page_info, -1)
end
%>
</td>
<td><%= html.html_escape(cert.user) %></td>
<td><%= html.html_escape(cert.certtype) %></td>
<td><%= html.html_escape(cert.commonName) %></td>
<td><%= html.html_escape(tostring(tonumber('0x'..cert.serial))) %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% htmlviewfunctions.displaysectionend(header_level) %>
<%
if viewlibrary.check_permission("getrevoked") then
htmlviewfunctions.displaysectionstart(cfe({label="Get revoked list (crl)"}), page_info, header_level)
htmlviewfunctions.displayitem(cfe({type="link", value={crltype=cfe({type="hidden", value="PEM"}), viewtype=viewtype}, label="", option="Download PEM", action="getrevoked"}), page_info, -1)
htmlviewfunctions.displayitem(cfe({type="link", value={crltype=cfe({type="hidden", value="DER"}), viewtype=viewtype}, label="", option="Download DER", action="getrevoked"}), page_info, -1)
htmlviewfunctions.displaysectionend(header_level)
end
%>
|