Alfresco trick: bulk users invitation to a site (external and internal users)

For a personal project I was wondering if I can invite a group of friends to a site without having to get them access to my Alfresco, just wanted to give them access to certain site as consumers.

Here is how I did that, once I generate a list of friends like below (file solo-mails.txt):

name1@hotmail.com
name2@gmail.com
name3@yahoo.es

I run next curl command in JSON format. Remember that $i is the mail address of any friend, use your own admin credentials as user:password, you should change ‘surname’, localhost, and site name ‘mysite’ in the URL. The option -H “Accept-Language: en,en;q=0.8” will send the invitation in english, if you want to sent it in spanish use Accept-Language: es,en;q=0.8.

for i in `cat solo-mails.txt`; do curl -i -u user:password -H “Content-Type: application/json” -H “Accept-Language: en,en;q=0.8” -d “{‘invitationType’:’NOMINATED’,’inviteeUserName’:”,’inviteeRoleName’:’SiteConsumer‘,’inviteeFirstName’:’$i‘,’inviteeLastName’:’surname‘,’inviteeEmail’:’$i‘,’serverPath’:’http://localhost:8080/share/’,’acceptURL’:’page/accept-invite’,’rejectURL’:’page/reject-invite’}” “http://localhost:8080/alfresco/s/api/sites/mysite/invitations“; done
This command will send an invitation with an autogenerated username and a password.

As I mentioned, command above is for external users, but if you want to do same thing for internals use same command but the value ‘inviteeUserName’ has to have the username you want to invite, for example ‘inviteeUserName’:’toni’. Obviously I run this command from my Mac also valid from a Linux with curl.

Thanks to my colleague at Alfresco Rui Fernandes, he pointed me out about where to start.

2 thoughts to “Alfresco trick: bulk users invitation to a site (external and internal users)”

  1. Hola Toni:

    ¿ Probaste las alfresco-shell-tools ?
    Es un addon que tiene un conjunto de scripts de shell y que usa estrategias REST via curl similares.

    Un saludo y hablamos.

    –C.

  2. Creo que hablé de ese proyecto por Twitter hace ya, la verdad es que ayer no me acordé de esas herramientas pero he mirado y no sé si la opción de añadir a grupo me hubiera servido ya que en mi caso son usuarios externos.

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.