cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Join On invite for Site

mcasanket
Champ on-the-rise
Champ on-the-rise
Hi All,  Smiley Very Happy
     In one requirement, I want the user to be a member automatically when he/she invited for Site. I meant, suppose I create a site and invite a person abc. Then the abc will joined the site automatically.


Please help!
Thanking you!  Smiley Sad
4 REPLIES 4

zladuric
Champ on-the-rise
Champ on-the-rise
You would have to change the code for the invitation webscript/workflow or just write a new webscript and link your invitation button/whatever to it.

You can set site membership in js like this:
var site = siteService.getSite("demosite");
site.setMembership("mcasanket", "SiteCollaborator");

Just adapt it to your needs.

mcasanket
Champ on-the-rise
Champ on-the-rise
Thanks Zladuric,
  
  I have tried the code that you gave in last post. But it gives me error related to some transaction. It says it is read only transaction. Just for testing I put the code in tomcat\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\repository\site\membership\potentialmembers.get.js. I have put hard coded code like
site.setMembership("mcasanket", "SiteCollaborator");
.

You can set site membership in js like this:
var site = siteService.getSite("demosite");
site.setMembership("mcasanket", "SiteCollaborator");

Thanking You!

zladuric
Champ on-the-rise
Champ on-the-rise
This will always set the same ("mcasanket") user to site, is that what you want?

Or did you alternate it so you take the username from the script arguments?

mcasanket
Champ on-the-rise
Champ on-the-rise
Thanks Zladuric,
      
   No I set it for just testing. Thanks your post helped me a lot. I have put the line of code in tomcat\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\repository\site\invitation\invitation.post.json.js. And it is working fine.


This will always set the same ("mcasanket") user to site, is that what you want?
Or did you alternate it so you take the username from the script arguments?


Thanks a lot Zladuric.