protected int removeSecurityDef(RequestContext requestContext, Map<String,Object> resultMap, Node node) throws AJAXException { String id = getActionParameter(requestContext, "id"); if (isBlank(id)) throw new AJAXException("Invalid Security Ref: id invalid data."); if (node.getSecurityConstraints() == null) { return 0; } List defs = node.getSecurityConstraints().getSecurityConstraints(); if (defs == null || defs.size() == 0) { return 0; } if (id.length() == 1) return 0; id = id.substring(1); int index = Integer.parseInt(id) - 1; if (index < 0) { return 0; } defs.remove(index); return 1; }
protected int removeSecurityReference(RequestContext requestContext, Map<String,Object> resultMap, Node node) throws AJAXException { String name = getActionParameter(requestContext, "name"); String kind = getActionParameter(requestContext, "kind"); if (isBlank(name) || isBlank(kind)) throw new AJAXException("Invalid Security Ref: name invalid data."); if (node.getSecurityConstraints() == null) { return 0; } if (kind.equals("Owner")) { node.getSecurityConstraints().setOwner(null); } else { List refs = node.getSecurityConstraints().getSecurityConstraintsRefs(); if (!refs.contains(name)) return 0; // nothing to do refs.remove(name); } return 1; }
protected int insertSecurityReference(RequestContext requestContext, Map<String,Object> resultMap, Node node) throws AJAXException { String name = getActionParameter(requestContext, "name"); String kind = getActionParameter(requestContext, "kind"); if (isBlank(name) || isBlank(kind)) throw new AJAXException("Invalid Security Ref: name invalid data."); if (node.getSecurityConstraints() == null) { SecurityConstraints cons = node.newSecurityConstraints(); node.setSecurityConstraints(cons); } if (kind.equals("Owner")) { node.getSecurityConstraints().setOwner(name); } else { List refs = node.getSecurityConstraints().getSecurityConstraintsRefs(); if (refs.contains(name)) return 0; // do nothing refs.add(name); } return 1; }
if (isBlank(name) || isBlank(oldName) || isBlank(kind)) throw new AJAXException("Invalid Security Ref: name invalid data."); if (node.getSecurityConstraints() == null) List refs = node.getSecurityConstraints().getSecurityConstraintsRefs(); if (refs == null || refs.size() == 0) if (kind.equals("Owner")) node.getSecurityConstraints().setOwner(name); found = true;