key = (Key) keyItr.next();
ServletActions sa = (DescriptorProcessor.ServletActions) reslist.get(key);
SipResourcePermission srp = new SipResourcePermission(key.servletName,
sa.actions);
Permissions p = null;
if (permCollection.containsKey(key.roleName)) {
p = permCollection.get(key.roleName);
} else {
p = new Permissions();
permCollection.put(key.roleName, p);
}
p.add(srp);
pc.addToRole(key.roleName,
new SipRoleRefPermission(key.servletName, key.roleName));
}
Iterator<String> permItr = permCollection.keySet().iterator();
while (permItr.hasNext()) {
String role = permItr.next();
Permissions perms = (Permissions) permCollection.get(role);
pc.addToRole(role, perms);
}
Map<String, Servlet> servlets = sipConfig.getServlets();
Iterator<Servlet> servletItr = servlets.values().iterator();
while (servletItr.hasNext()) {
Servlet servlet = servletItr.next();
String servletName = servlet.getServletName();
Enumeration<RoleReference> srRef = servlet.getSecurityRoleReferences();
if (srRef != null) {
// Iterator<SecurityRoleReference> srItr = srRef.iterator();
while (srRef.hasMoreElements()) {
RoleReference srr = srRef.nextElement();
String roleLink = srr.getSecurityRoleLink().getName();
String roleName = srr.getRolename();
SipRoleRefPermission srp = new SipRoleRefPermission(servletName,
roleName);
pc.addToRole(roleLink, srp);
}
}
}
Permissions udcPermList = new Permissions();
Iterator<TransportConstraints> tcItr = userDataConsTable.values().iterator();
while (tcItr.hasNext()) {
TransportConstraints tcValue = tcItr.next();
//String[] actions = tcValue.actions.toArray(new String[0]);
SipUserDataPermission wdp = new SipUserDataPermission(tcValue.servletName,
tcValue.actions, tcValue.getType());
noUDPerm = false;
//SipUserDataPermission(tcValue.servletName, actions, tcValue.getType());
udcPermList.add(wdp);
}
if (noUDPerm) {
addDefaultUserDataPermissions(sipConfig, udcPermList);
}
Map<String, Servlet> servletList = sipConfig.getServlets();
Iterator<String> sitr = servletList.keySet().iterator();
while (sitr.hasNext()) {
String sn = sitr.next();
// if (restrictedActionList.containsKey(sn)) {
// continue;
// }
Set<String> ral = restrictedActionList.get(sn);
Set<String> allowedActions = new HashSet<String>();
if (ral == null) {
SipResourcePermission srp = new SipResourcePermission(sn, allowedActions);
udcPermList.add(srp);
continue;
}
Iterator<String> ralItr = ral.iterator();
while (ralItr.hasNext()) {
allowedActions.add(ralItr.next());
}
SipResourcePermission srp = new SipResourcePermission(true, sn, allowedActions);
udcPermList.add(srp);
}
pc.addToUncheckedPolicy(udcPermList);
pc.commit();