* @return ActionForward
* @throws Exception
*/
public ActionForward doCommit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
IpRestrictionForm ipRestrictionForm = (IpRestrictionForm)form;
ipRestrictionForm.apply();
Permission permission = ipRestrictionForm.isEditing() ? PolicyConstants.PERM_EDIT : PolicyConstants.PERM_CREATE;
PolicyUtil.checkPermission(PolicyConstants.IP_RESTRICTIONS_RESOURCE_TYPE, permission, request);
try {
if(ipRestrictionForm.isEditing()) {
SystemDatabaseFactory.getInstance().updateIpRestriction(ipRestrictionForm.getRestriction());
}
else {
SystemDatabaseFactory.getInstance().addIpRestriction(ipRestrictionForm.getRestriction().getAddress(), ipRestrictionForm.getRestriction().getType());
}
fireCoreEvent(request, ipRestrictionForm, CoreEvent.STATE_SUCCESSFUL);
saveMessage(request, "editIpRestriction.message.restrictionSaved", ipRestrictionForm.getRestriction().getAddress());
} catch (Exception e) {
fireCoreEvent(request, ipRestrictionForm, CoreEvent.STATE_UNSUCCESSFUL);
throw e;
}
return cancel(mapping, form, request, response);