As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
public void setAccessControlList(Store store, String path, boolean inheritPermissions, Hashtable<String, String> accessControl) { accessControlService = WebServiceFactory.getAccessControlService(); Reference ref = new Reference(store, null, getXPathEscape(path)); Predicate predicate = new Predicate(new Reference[] { ref }, store, null); ACE[] aces = new ACE[accessControl.size()]; // remove existing … accessControlService.removeACEs(predicate, null); accessControlService.addACEs(predicate, aces); accessControlService.setInheritPermission(predicate, inheritPermissions); }
public static void invitarUsuarios(String spaceName, String storeName, String invitado) { final String consulta = "@\\{http\\://www.alfresco.org/model/content/1.0\\}name:\"" + spaceName + "\""; final Store store = new Store(Constants.WORKSPACE_STORE, storeName); ResultSetRow[] elencoNodos = getEspacioNodo(store, consulta); Predicate predicate = new Predicate(); predicate.setStore(store); // cicle through the nodes for (ResultSetRow fila : elencoNodos) { Reference ref = new Reference(); ref.setStore(store); ref.setUuid(fila.getNode().getId()); predicate.setNodes(new Reference[] { ref }); } AccessControlServiceSoapBindingStub accessControlService = WebServiceFactory.getAccessControlService(); try { accessControlService.setOwners(predicate, invitado); } catch (AccessControlFault e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private static ResultSetRow[] getEspacioNodo(Store store, String consulta) { ResultSetRow[] elencoNodos = null; //Construimos la query Query query = new Query(); query.setLanguage(Constants.QUERY_LANG_LUCENE); query.setStatement(consulta); try { //Ejecutamos la query y recogemos los resultados QueryResult qrst = WebServiceFactory.getRepositoryService().query(store, query, false); ResultSet rst = qrst.getResultSet(); long numRec = rst.getTotalRowCount(); System.out.println("Encontrados " + numRec + " nodos."); elencoNodos = rst.getRows(); } catch (RepositoryFault e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } return elencoNodos; }
public static void invitarUsuarios(String spaceName, String storeName, String invitado, String permiso, boolean eliminarInvitacionesAnteriores) { final String consulta = "@\\{http\\://www.alfresco.org/model/content/1.0\\}name:\"" + spaceName + "\""; final Store store = new Store(Constants.WORKSPACE_STORE, storeName); ResultSetRow[] elencoNodos = getEspacioNodo(store, consulta); Predicate predicate = new Predicate(); predicate.setStore(store); // cicle through the nodes for (ResultSetRow fila : elencoNodos) { Reference ref = new Reference(); ref.setStore(store); ref.setUuid(fila.getNode().getId()); predicate.setNodes(new Reference[] { ref }); AccessControlServiceSoapBindingStub accessControlService = WebServiceFactory .getAccessControlService(); try { // Establece Owner (Propietario) – yo no lo haría… accessControlService.setOwners(predicate, invitado); // Invita como coordinator ACE[] aces = new ACE[1]; aces[0] = new ACE(); aces[0].setAuthority(invitado); aces[0].setPermission(permiso); aces[0].setAccessStatus(AccessStatus.acepted); if (eliminarInvitacionesAnteriores) { // remove existing … accessControlService.removeACEs(predicate, null); } accessControlService.addACEs(predicate, aces); } catch (AccessControlFault e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
invitarUsuarios("pruebaWebService", "SpacesStore", "adrian", "Coordinator", false);