@Override public Access checkPermission(Document doc, ACP mergedAcp, NuxeoPrincipal principal, String permission, String[] resolvedPermissions, String[] additionalPrincipals) { Access access = Access.UNKNOWN; if (Arrays.asList(resolvedPermissions).contains(SecurityConstants.WRITE_PROPERTIES) && !doc.isVersion() && !doc.isProxy()) { if (!doc.isCheckedOut()) { access = Access.DENY; } } return access; }
@Override public void doPostCreate(Document doc, Map<String, Serializable> options) { if (doc.isVersion() || doc.isProxy()) { return; } setInitialVersion(doc); }
@Override public void restore(Document version) { if (!version.isVersion()) { throw new NuxeoException("Cannot restore a non-version: " + version); } session.restore(getNode(), ((SQLDocument) version).getNode()); }
if (!doc.isVersion() && !doc.isProxy() && !doc.isCheckedOut()) { if (!deleteTransitions || Framework.getService(ConfigurationService.class) .isBooleanPropertyFalse(TRASH_KEEP_CHECKED_IN_PROPERTY)) {
if (source.isVersion()) {
@Override public ACP getMergedACP(Document doc) { Document base = doc.isVersion() ? doc.getSourceDocument() : doc; if (base == null) { return null; } ACP acp = getACP(base); if (doc.getParent() == null) { return acp; } // get inherited acls only if no blocking inheritance ACE exists in the top level acp. ACL acl = null; if (acp == null || acp.getAccess(SecurityConstants.EVERYONE, SecurityConstants.EVERYTHING) != Access.DENY) { acl = getInheritedACLs(doc); } if (acp == null) { if (acl == null) { return null; } acp = new ACPImpl(); } if (acl != null) { acp.addACL(acl); } return acp; }
if (doc.isVersion()) {
@Override public Document createProxy(Document doc, Document folder) { Node folderNode = ((SQLDocument) folder).getNode(); Node targetNode = ((SQLDocument) doc).getNode(); Serializable targetId = targetNode.getId(); Serializable versionableId; if (doc.isVersion()) { versionableId = targetNode.getSimpleProperty(Model.VERSION_VERSIONABLE_PROP).getValue(); } else if (doc.isProxy()) { // copy the proxy targetId = targetNode.getSimpleProperty(Model.PROXY_TARGET_PROP).getValue(); versionableId = targetNode.getSimpleProperty(Model.PROXY_VERSIONABLE_PROP).getValue(); } else { // working copy (live document) versionableId = targetId; } String name = findFreeName(folderNode, doc.getName()); Node proxy = session.addProxy(targetId, versionableId, folderNode, name, null); return newDocument(proxy); }
boolean setReadWrite = allowVersionWrite && doc.isVersion() && doc.isReadOnly();