private static void asignarPermisos(String user, String id) throws AccessControlFault, RemoteException
{
DMSConnectionAlfresco dms = new DMSConnectionAlfresco();
ProfileTO profileUser = new ProfileTO();
profileUser.setUserName("admin");
profileUser.setPassword("admin");
AccessControlServiceSoapBindingStub accessControlService = WebServiceFactory.getAccessControlService();
Predicate predicate = new Predicate();
predicate.setStore(dms.getStore());
Reference ref = new Reference();
ref.setStore(dms.getStore());
ref.setUuid(id);
predicate.setNodes(new Reference[] { ref });
ACL[] acl = accessControlService.getACLs(predicate, null);
ACE[] ace = acl[0].getAces();
AccessStatus accessStatus = ace[0].getAccessStatus();
System.out.println(ace[0].getAuthority()); //Retorna 1r usuario que tiene permisos sobre el nodo
System.out.println(ace[0].getPermission()); //Retorna el permiso especificado para el usuario anterior
System.out.println(accessStatus.getValue()); //Retorna si tiene acceso o no al nodo
//Añadir permisos
ACE[] aces1 = new ACE[]{new ACE(user, Constants.READ, AccessStatus.acepted)};
ACL[] acls1 = accessControlService.addACEs(predicate, aces1);
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.