@Override protected DocumentModel initCreateUserWorkspace(CoreSession unrestrictedSession, DocumentModel doc, String username) { ACP acp = new ACPImpl(); ACE grantEverything = new ACE(username, SecurityConstants.EVERYTHING, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { grantEverything }); acp.addACL(acl); doc.setACP(acp, true); Map<String, Serializable> properties = new HashMap<>(); properties.put("username", username); notifyEvent(unrestrictedSession, doc, unrestrictedSession.getPrincipal(), DocumentEventTypes.USER_WORKSPACE_CREATED, properties); return doc; }
@Override protected DocumentModel initCreateUserWorkspacesRoot(CoreSession unrestrictedSession, DocumentModel doc) { ACP acp = new ACPImpl(); ACE denyEverything = new ACE(SecurityConstants.EVERYONE, SecurityConstants.EVERYTHING, false); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { denyEverything }); acp.addACL(acl); doc.setACP(acp, true); return doc; }
acl.setACEs(acesList.toArray(new ACE[acesList.size()])); acp.addACL(acl); this.session.setACP(createDocument.getRef(), acp,
protected void setFoldersACL(DocumentModel doc, String userName) throws ClientException { ACP acp = new ACPImpl(); ACE grantMembersRead = new ACE(SecurityConstants.EVERYONE, SecurityConstants.READ, true); ACE grantEverything = new ACE(userName, SecurityConstants.EVERYTHING, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { grantMembersRead, grantEverything }); acp.addACL(acl); doc.setACP(acp, true); } }
protected void setCommentPermissions(CoreSession session, DocumentModel documentModel) { ACP acp = new ACPImpl(); ACE grantRead = new ACE(SecurityConstants.EVERYONE, SecurityConstants.READ, true); ACE grantRemove = new ACE("members", SecurityConstants.REMOVE, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { grantRead, grantRemove }); acp.addACL(acl); session.setACP(documentModel.getRef(), acp, true); }
protected void setFoldersACL( DocumentModel doc, String userName) throws ClientException { // UserService userService = Framework.getService(UserService.class); // String defaultGroup = userService.getUserManager().getDefaultGroup(); ACP acp = new ACPImpl(); // ACE grantMembersRead = new ACE(defaultGroup, SecurityConstants.READ, // true); ACE grantMembersRead = new ACE(SecurityConstants.MEMBERS, SecurityConstants.READ, true); ACE grantEverything = new ACE(userName, SecurityConstants.EVERYTHING, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { grantMembersRead, grantEverything }); acp.addACL(acl); doc.setACP(acp, true); } }
protected void setFolderPermissions(CoreSession session, DocumentModel documentModel) { ACP acp = new ACPImpl(); ACE grantAddChildren = new ACE("members", SecurityConstants.ADD_CHILDREN, true); ACE grantRemoveChildren = new ACE("members", SecurityConstants.REMOVE_CHILDREN, true); ACE grantRemove = new ACE("members", SecurityConstants.REMOVE, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { grantAddChildren, grantRemoveChildren, grantRemove }); acp.addACL(acl); session.setACP(documentModel.getRef(), acp, true); }
/** * @since 10.3 */ protected DocumentModel initCreateFavorites(CoreSession session, DocumentModel favorites) { ACP acp = new ACPImpl(); ACE denyEverything = new ACE(SecurityConstants.EVERYONE, SecurityConstants.EVERYTHING, false); ACE allowEverything = new ACE(session.getPrincipal().getName(), SecurityConstants.EVERYTHING, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { allowEverything, denyEverything }); acp.addACL(acl); favorites.setACP(acp, true); return favorites; }
/** * @since 10.3 */ protected DocumentModel initDefaultCollectionsRoot(final CoreSession session, DocumentModel collectionsRoot) { ACP acp = new ACPImpl(); ACE denyEverything = new ACE(SecurityConstants.EVERYONE, SecurityConstants.EVERYTHING, false); ACE allowEverything = new ACE(session.getPrincipal().getName(), SecurityConstants.EVERYTHING, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { allowEverything, denyEverything }); acp.addACL(acl); collectionsRoot.setACP(acp, true); return collectionsRoot; }
protected static DocumentModel createUserWorkspaceDomain( CoreSession unrestrictedSession, String domainName) throws ClientException { DocumentModel doc = unrestrictedSession.createDocumentModel("/",domainName, "Domain"); doc.setProperty("dublincore", "title", domainName); doc.setProperty("dublincore", "description", ""); doc = unrestrictedSession.createDocument(doc); ACP acp = new ACPImpl(); ACE denyEverything = new ACE(SecurityConstants.EVERYONE, SecurityConstants.EVERYTHING, false); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { denyEverything }); acp.addACL(acl); doc.setACP(acp, true); return doc; }
protected static DocumentModel createUserWorkspace( CoreSession unrestrictedSession, PathRef wsRef, String userName) throws ClientException { String parentPath = new Path(wsRef.toString()).removeLastSegments(1).toString(); String wsName = new Path(wsRef.toString()).lastSegment(); DocumentModel doc = unrestrictedSession.createDocumentModel(parentPath, wsName,"UserWorkspace"); doc.setProperty("dublincore", "title", userName); doc.setProperty("dublincore", "description", ""); doc = unrestrictedSession.createDocument(doc); ACP acp = new ACPImpl(); ACE grantEverything = new ACE(userName, SecurityConstants.EVERYTHING, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { grantEverything }); acp.addACL(acl); doc.setACP(acp, true); return doc; }
protected static DocumentModel createUserWorkspacesRoot( CoreSession unrestrictedSession, PathRef rootRef) throws ClientException { String parentPath = new Path(rootRef.toString()).removeLastSegments(1).toString(); String docName = new Path(rootRef.toString()).lastSegment(); DocumentModel doc = unrestrictedSession.createDocumentModel(parentPath, docName,"UserWorkspacesRoot"); doc.setProperty("dublincore", "title", docName); doc.setProperty("dublincore", "description", ""); doc = unrestrictedSession.createDocument(doc); ACP acp = new ACPImpl(); ACE denyEverything = new ACE(SecurityConstants.EVERYONE, SecurityConstants.EVERYTHING, false); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { denyEverything }); acp.addACL(acl); doc.setACP(acp, true); return doc; }