privileges_jsp.java
11.2 KB
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.crx.i18n.Dictionary
* javax.jcr.RepositoryException
* javax.jcr.Session
* javax.jcr.Workspace
* javax.jcr.security.Privilege
* javax.servlet.Servlet
* javax.servlet.ServletConfig
* javax.servlet.ServletContext
* javax.servlet.ServletException
* javax.servlet.ServletRequest
* javax.servlet.ServletResponse
* javax.servlet.http.HttpServletRequest
* javax.servlet.http.HttpServletResponse
* javax.servlet.jsp.JspFactory
* javax.servlet.jsp.JspWriter
* javax.servlet.jsp.PageContext
* javax.servlet.jsp.SkipPageException
* org.apache.commons.lang3.StringEscapeUtils
* org.apache.jackrabbit.api.JackrabbitWorkspace
* org.apache.jackrabbit.api.security.authorization.PrivilegeManager
* org.apache.jasper.runtime.HttpJspBase
* org.apache.jasper.runtime.JspRuntimeLibrary
* org.apache.jasper.runtime.JspSourceDependent
*/
package com.day.crx.explorer.impl.jsp.config;
import com.day.crx.explorer.impl.j2ee.CRXContext;
import com.day.crx.explorer.impl.util.PrivilegeComparator;
import com.day.crx.explorer.impl.util.RequestData;
import com.day.crx.i18n.Dictionary;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Workspace;
import javax.jcr.security.Privilege;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspFactory;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.SkipPageException;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.jackrabbit.api.JackrabbitWorkspace;
import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
import org.apache.jasper.runtime.HttpJspBase;
import org.apache.jasper.runtime.JspRuntimeLibrary;
import org.apache.jasper.runtime.JspSourceDependent;
public final class privileges_jsp
extends HttpJspBase
implements JspSourceDependent {
private static List _jspx_dependants;
public Object getDependants() {
return _jspx_dependants;
}
/*
* Unable to fully structure code
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
block18 : {
_jspxFactory = null;
pageContext = null;
out = null;
_jspx_out = null;
_jspx_page_context = null;
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html");
_jspx_page_context = pageContext = _jspxFactory.getPageContext((Servlet)this, (ServletRequest)request, (ServletResponse)response, null, false, 8192, true);
pageContext.getServletContext();
pageContext.getServletConfig();
_jspx_out = out = pageContext.getOut();
response.setContentType("text/html; charset=utf-8");
ctx = CRXContext.getInstance(pageContext, request);
repSession = ctx.getSession();
if (repSession != null && repSession.getWorkspace() instanceof JackrabbitWorkspace) break block18;
if (_jspxFactory == null) return;
_jspxFactory.releasePageContext(_jspx_page_context);
return;
}
try {
req = ctx.getRequestData();
dict = ctx.getCurrentDictionary();
privilegeMgr = ((JackrabbitWorkspace)repSession.getWorkspace()).getPrivilegeManager();
error = null;
success = null;
action = req.getParameter("action", "");
if ("register".equals(action) && "POST".equals(request.getMethod())) {
privNameParam = req.getParameter("privilegeName", "");
try {
isAbstract = Boolean.parseBoolean(req.getParameter("isAbstract", ""));
declAggrNames = req.getParameterValues("declAggrNames");
privilegeMgr.registerPrivilege(privNameParam, isAbstract, declAggrNames);
success = dict.fmt("Registered new custom privilege ''{0}''", (Object)privNameParam);
}
catch (RepositoryException e) {
error = dict.fmt("Error while registering custom privilege ''{0}'': {1}", (Object)privNameParam, (Object)e.toString());
}
}
request.setAttribute("crx.explorer.pageName", (Object)"config");
out.write("<html>\n ");
JspRuntimeLibrary.include((ServletRequest)request, (ServletResponse)response, (String)"../index_head.jsp", (JspWriter)out, (boolean)true);
if (!ctx.isAdmin()) ** GOTO lbl71
if (error != null) {
out.write("<tr><td class=\"content\" colspan=\"2\"><font color=\"red\"><b>");
out.print(StringEscapeUtils.escapeHtml4((String)error));
out.write("</b></font></td></tr>");
}
if (success != null) {
out.write("<tr><td class=\"content\" colspan=\"2\"><font color=\"green\"><b>");
out.print(StringEscapeUtils.escapeHtml4((String)success));
out.write("</b></font></td></tr>");
}
privs = privilegeMgr.getRegisteredPrivileges();
Arrays.sort(privs, new PrivilegeComparator());
out.write("<tr><td class=\"content\" colspan=\"2\"><b>");
out.print(dict.msg("crex.privileges_registered.tit"));
out.write("</b></td></tr>");
out.write("<tr><td colspan=\"2\">");
out.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"left\" width=\"100%\"><tbody>");
out.write("<tr><td class=\"content\"><span style=\"color:#666666\"><b>");
out.print(dict.msg("crex.privilege_name.txt"));
out.write("</b></span></td>");
out.write("<td class=\"content\"><span style=\"color:#666666\"><b>");
out.print(dict.msg("crex.privilege_isabstract.txt"));
out.write("</b></span></td>");
out.write("<td class=\"content\"><span style=\"color:#666666\"><b>");
out.print(dict.msg("crex.privilege_declaggrnames.txt"));
out.write("</b></span></td></tr>");
arrprivilege = privs;
declAggrNames = 0;
n = arrprivilege.length;
** GOTO lbl117
lbl71: // 1 sources:
out.write("<tr><td class=\"content\" colspan=\"2\">\n <span style=\"color:red\">");
out.print(dict.msg("Please login as <b>admin</b> first."));
out.write("</span>\n </td></tr>");
lbl74: // 2 sources:
do {
JspRuntimeLibrary.include((ServletRequest)request, (ServletResponse)response, (String)"../index_foot.jsp", (JspWriter)out, (boolean)true);
out.write("</html>\n");
return;
break;
} while (true);
}
catch (Throwable t) {
try {
if (t instanceof SkipPageException != false) return;
out = _jspx_out;
if (out != null && out.getBufferSize() != 0) {
out.clearBuffer();
}
if (_jspx_page_context == null) return;
_jspx_page_context.handlePageException(t);
return;
}
catch (Throwable throwable) {
throw throwable;
}
finally {
if (_jspxFactory != null) {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
lbl-1000: // 1 sources:
{
priv = arrprivilege[declAggrNames];
out.write("<tr><td class=\"content\">");
out.print(StringEscapeUtils.escapeHtml4((String)priv.getName()));
out.write("</td>");
out.write("<td class=\"content\">");
out.print(priv.isAbstract());
out.write("</td>");
out.write("<td class=\"content\">");
if (!priv.isAggregate()) ** GOTO lbl108
daps = priv.getDeclaredAggregatePrivileges();
Arrays.sort(daps, new PrivilegeComparator());
arrprivilege2 = daps;
n2 = 0;
n3 = arrprivilege2.length;
** GOTO lbl114
lbl108: // 1 sources:
out.write(45);
** GOTO lbl115
lbl-1000: // 1 sources:
{
dp = arrprivilege2[n2];
out.print(StringEscapeUtils.escapeHtml4((String)dp.getName()));
out.write("<br>");
++n2;
lbl114: // 2 sources:
** while (n2 < n3)
}
lbl115: // 2 sources:
out.write("</td></tr>");
++declAggrNames;
lbl117: // 2 sources:
** while (declAggrNames < n)
}
lbl118: // 1 sources:
out.write("</tbody></table>");
out.write("</td></tr>");
out.write("<tr><td class=\"content\" colspan=\"2\"><br><b>");
out.print(dict.msg("crex.privilege_register_custom.tit"));
out.write("</b></td></tr>");
out.write("<form action=\"\" method=\"POST\" enctype=\"multipart/form-data\">");
out.write("<tr><td width=\"40%\" class=\"content\">");
out.print(dict.msg("crex.privilege_name.txt"));
out.write(":</td><td class=\"content\"><input type=\"text\" name=\"privilegeName\" value=\"\"></td></tr>");
out.write("<tr><td width=\"40%\" class=\"content\">");
out.print(dict.msg("crex.privilege_isabstract.txt"));
out.write(":</td><td class=\"content\"><input type=\"radio\" name=\"isAbstract\" value=\"true\">true<br><input type=\"radio\" name=\"isAbstract\" value=\"false\">false</td></tr>");
out.write("<tr><td width=\"40%\" class=\"content\">");
out.print(dict.msg("crex.privilege_declaggrnames.txt"));
out.write(":</td class=\"content\"><td><select name=\"declAggrNames\" multiple=\"true\">");
arrprivilege = privs;
declAggrNames = 0;
n = arrprivilege.length;
while (declAggrNames < n) {
priv = arrprivilege[declAggrNames];
name = StringEscapeUtils.escapeHtml4((String)priv.getName());
out.write("<option value=\"");
out.print(name);
out.write(34);
out.write(62);
out.print(name);
++declAggrNames;
}
out.write("</select></td></tr>");
out.write("<tr><td class=\"content\" colspan=\"2\"><input type=\"hidden\" name=\"");
out.print("FormEncoding");
out.write("\" value=\"");
out.print(StringEscapeUtils.escapeHtml4((String)response.getCharacterEncoding()));
out.write(34);
out.write(62);
out.write("<input type=\"hidden\" name=\"action\" value=\"register\"><input type=\"submit\" value=\"Register\"></td></tr>");
out.write("</form>");
** while (true)
}
}