cancel
Showing results for 
Search instead for 
Did you mean: 

Eliminar Usuarios

blackheart
Champ in-the-making
Champ in-the-making
Hola gente,

He introducido cerca de 350 usuarios mediante un archivo .csv pero las columnas no me cuadran y tengo que eliminarlos y volver a meterlos, pero quiero saber si tengo que eliminar uno a uno los usuarios o hay alguna otra forma de eliminarlos todos a la vez?

Gracias, de antemano.
11 REPLIES 11

angelborroy
Community Manager Community Manager
Community Manager
Desde el interfaz web de Alfresco Share no hay posibilidad, tendrías que hacerlo a través de alguna de las APIs (JavaScript, CMIS / REST o Java).
Hyland Developer Evangelist

y como lo harías de la forma que me estas diciendo, para poder aplicarlo.

angelborroy
Community Manager Community Manager
Community Manager
Supongo que lo más cómodo sería instalar el addon https://github.com/share-extras/js-console y lanzar un JavaScript similar al siguiente:

<code lang="javascript">
var user;
var nodes = people.getPeople(null);
for each(var node in nodes) {
  user = utils.getNodeFromString(node);
  if (user.properties["cm:userName"] != "admin") {
      logger.log(user.properties["cm:userName"]);
      user.delete();
  }
}
</code>

Asegúrate de probar este código antes en otra instancia de prueba, yo no lo he probado.
Hyland Developer Evangelist

Me sale un error

"500 Internal Error
Stacktrace-Details:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function delete in object Node Type: {http://www.alfresco.org/model/content/1.0}person, Node Aspects: [{http://www.alfresco.org/model/content/1.0}ownable, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/system/1.0}localized]. (Javascript Console Script#11)

An error inside the HTTP server which prevented it from fulfilling the request.
02290002 Wrapped Exception (with status template): 02290018 Failed to execute script 'Javascript Console Script': 02290017 TypeError: Cannot find function delete in object Node Type: {http://www.alfresco.org/model/content/1.0}person, Node Aspects: [{http://www.alfresco.org/model/content/1.0}ownable, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/system/1.0}localized]. (Javascript Console Script#11)"

blackheart
Champ in-the-making
Champ in-the-making
No he instalado addon y no se como hacerlo, me podrias orientar?

angelborroy
Community Manager Community Manager
Community Manager
Tienes los apartados de instalación y build en la propia página GitHub del proyecto: https://github.com/share-extras/js-console#installation
Hyland Developer Evangelist

blackheart
Champ in-the-making
Champ in-the-making
Me sale este error al ejecutarlo en la Javascript Console

"500 Internal Error
Stacktrace-Details:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function delete in object Node Type: {http://www.alfresco.org/model/content/1.0}person, Node Aspects: [{http://www.alfresco.org/model/content/1.0}ownable, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/system/1.0}localized]. (Javascript Console Script#11)

An error inside the HTTP server which prevented it from fulfilling the request.
02290002 Wrapped Exception (with status template): 02290018 Failed to execute script 'Javascript Console Script': 02290017 TypeError: Cannot find function delete in object Node Type: {http://www.alfresco.org/model/content/1.0}person, Node Aspects: [{http://www.alfresco.org/model/content/1.0}ownable, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/system/1.0}localized]. (Javascript Console Script#11)"

angelborroy
Community Manager Community Manager
Community Manager
Inténtalo con esta modificación:


var user;
var nodes = people.getPeople(null);
for each(var node in nodes) {
   user = utils.getNodeFromString(node);
   if (user.properties["cm:userName"] != "admin") {
      logger.log(user.properties["cm:userName"]);
      people.deletePerson(user.properties["cm:userName"]);
   }
}
Hyland Developer Evangelist

blackheart
Champ in-the-making
Champ in-the-making
ahora me sale que el usuario invitado no puede ser borrado

"500 Internal Error
Stacktrace-Details:
org.alfresco.error.AlfrescoRuntimeException: 02300147 The guest user cannot be deleted.

An error inside the HTTP server which prevented it from fulfilling the request.
02300012 Wrapped Exception (with status template): 02300148 Failed to execute script 'Javascript Console Script': 02300147 The guest user cannot be deleted."

He probado a poner
…if (user.properties["cm:userName"] != "admin" && "guest"){…, pero me sigue saliendo el mismo error