public boolean hasWriteAccess(Resource resource , Session userSession) throws RepositoryException {Node pageNode = resource.adaptTo(Node.class); String path = pageNode.getPath(); try { userSession.checkPermission(path, "add_node,set_property"); if(pageNode.hasNode(JcrConstants.JCR_CONTENT)) ...