i!,I've syncronized LDAP and Alfresco so that if the user does not exist inAlfresco but it does in LDAP it makes login in the system, but appart frommaking logging, I need it to create a series of folders and copy somecontents in such folder.I know that PersonServiceImpl is the class able to do so and thatcreatePerson is the method to be invoked in order to create such user, forthis reason, I've tried to modify the code so as to create the folders andcopy the contents, but it gives the following error:net.sf.acegisecurity.BadCredentialsException: Bad credentials presentedI join the code, Please, could you help me?
public FileFolderService createFileFolderService(){
System.out.println("Creando FileFolderService");
System.out.println("Registry"+registry);
fileFolderService = this.getServiceRegistry().getFileFolderService();
return fileFolderService;
}
public NodeRef createPerson(Map<QName, Serializable> properties) throws FileExistsException
{
try {
System.out.println("User"+AuthenticationUtil.getCurrentUserName());
AuthenticationUtils.startSession("admin", "admin");
AuthenticationUtil.setCurrentUser("admin");
AuthenticationUtil.setSystemUserAsCurrentUser();
System.out.println("User"+AuthenticationUtil.getCurrentUserName());
String userName = DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_USERNAME));
properties.put(ContentModel.PROP_USERNAME, userName);
NodeRef nodo = null;
this.setFileFolderService(createFileFolderService());
nodo = nodeService.createNode(getPeopleContainer(), ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_PERSON, ContentModel.TYPE_PERSON, properties).getChildRef();
NodeRef padre=null;
try{
padre = new NodeRef(APP+"company_home/"+CM+"config/"+CM+"usuarios");
}catch(Exception ex){
System.err.println("MIKI ERROR:"+ex.getMessage());
ex.printStackTrace(System.err);
}
fileFolderService.create(padre, userName, ContentModel.TYPE_FOLDER);
NodeRef archivoACopiar = new NodeRef(APP+"company_home/"+CM+"template");
NodeRef destinoCopia = new NodeRef(APP+"company_home/"+CM+"config/"+CM+"usuarios/"+CM+userName);
fileFolderService.copy(archivoACopiar, destinoCopia, SPLIT);
NodeRef segundoAC = new NodeRef(APP+"company_home/"+CM+"template/"+CM+"conf");
NodeRef segundoDC = new NodeRef(APP+"company_home/"+CM+"config/"+CM+"user/"+CM+userName);
fileFolderService.copy(segundoAC, segundoDC, SPLIT);
NodeRef tercerAC = new NodeRef(APP+"company_home/"+CM+"template/"+CM+"files");
fileFolderService.copy(tercerAC, segundoDC, SPLIT);
NodeRef cuartoAC = new NodeRef(APP+"company_home/"+CM+"template/"+CM+"trash");
fileFolderService.copy(cuartoAC, segundoDC, SPLIT);
return nodo;
}catch (Exception ex) {
Logger.getLogger(PersonServiceImplFidesol.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
Thank you very muchRegards