public void delete() { for (Principal memberOfPrincipal : getMemberships()) { memberOfPrincipal.removeMember(this); } for (Relationship accessRel : getUnderlyingNode().getRelationships(SecurityRelationshipTypes.ACCESS)) { accessRel.delete(); } deleteRootRelIfAny(); getUnderlyingNode().delete(); }
public void addMember(Principal principal) { // Add the principal as member in this principal if it isn't // already a member. if (findMemberRelationshipTo(principal) != null) { return; } principal .getUnderlyingNode() .createRelationshipTo(getUnderlyingNode(), SecurityRelationshipTypes.MEMBER); principal.deleteRootRelIfAny(); }