if(name != null)
{
String link = actionRequest.getParameter("link");
SecurityRoleRefComposite securityRoleRef = (SecurityRoleRefComposite) portlet.getInitSecurityRoleRefSet().get(name);
if(securityRoleRef == null && link != null)
{
securityRoleRef = (SecurityRoleRefComposite) portlet.addSecurityRoleRef(name, link);
}
if(securityRoleRef != null)
{
String description = actionRequest.getParameter("description");
if(description != null && description.length() > 0)
{
String locale = actionRequest.getParameter("locale");
if(locale == null)
{
locale = "en";
}
securityRoleRef.addDescription(new Locale(locale), description);
}
}
registry.savePortletDefinition(portlet);
}
}
else if(action.equals("edit_security"))
{
Iterator securityIter = portlet.getInitSecurityRoleRefSet().iterator();
while (securityIter.hasNext())
{
SecurityRoleRefComposite secRef = (SecurityRoleRefComposite) securityIter.next();
String name = secRef.getRoleName();
//TODO: should this be editable
String newName = actionRequest.getParameter(name + ":name");
String link = actionRequest.getParameter(name + ":link");
if(!secRef.getRoleLink().equals(link))
{
secRef.setRoleLink(link);
}
int index = 0;
Iterator descIter = secRef.getDescriptionSet().iterator();
while (descIter.hasNext())
{
MutableDescription description = (MutableDescription) descIter.next();
String descParam = actionRequest.getParameter(name + ":description:" + index);
//changing locale not allowed.