cancel
Showing results for 
Search instead for 
Did you mean: 

Adding members without invites

edwin_s
Champ in-the-making
Champ in-the-making
Hello,

I'm an administrator for an Alfresco 3.2 community installation, and I was wondering if there is a way to add members to an Alfresco Share site without going through the invite process?  The use case for this is that some groups would like to have their share site created without troubling their members with the extra process.  Personally, it's also easier just to add users to spaces outright.

In 3.0, I was able to go through the Alfresco site and use the Administrative Console, "Manage User Groups" function.  Now, it appears that the Alfresco site strips or hides the site groups now.

Thanks,
Ed
13 REPLIES 13

mrogers
Star Contributor
Star Contributor
Its not a bug when alfresco is working "as designed".  If it is in JIRA (I could not find it, so someone may need to raise it) it will need to be an "Enhancement" or an "Improvement" rather than a bug.   It may sound pedantic but the JIRA issues drive the test team and development priorities so it is important that they are categorised correctly.     And assuming there is an improvement in JIRA you should also vote for it to make it stand out from the crowd of other enhancements.   

As background to this issue, when we were putting the group support into Share sites we were worried about the performance implications of large nested groups on the site members screen.

michaelc
Champ on-the-rise
Champ on-the-rise
Can you use the Restful API for this ?
http://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference#Membership

I am a Newbie but this seems to fit your request I think.

Memberships

Adds a new membership to the site.

POST /alfresco/service/api/sites/{shortname}/memberships

Requirements:

    * Default Format: json
    * Authentication: user
    * Transaction: required
    * Format Style: any

Definition:

    * Id: org/alfresco/repository/site/membership/memberships.post
    * Description: classpath:alfresco/templates/webscripts/org/alfresco/repository/site/membership/memberships.post.desc.xml

nmcminn
Champ in-the-making
Champ in-the-making
Bringing this thread back from the dead.  I had to add a few users to some Share sites without using the invite mechanism, here's a writeup on one way to do it:

http://www.unorganizedmachines.com/site/software-and-technology/34-software-development/124-adding-a...

michaelc
Champ on-the-rise
Champ on-the-rise
Nice writeup.
I got to the same location with a little different method.
my initial client to test with I used a firefox plugin called poster.
it allowed to make restful calls until I got it right.
Much of my middle ware is in PHP so I pulled the following restful client as it seemed to have everything I needed.
http://www.phpclasses.org/package/5480-PHP-Send-Web-services-requests-to-REST-servers.html

I created a admin user for my backend work that has the needed rights.

when I included the user and password in the PUT it seemed to allways work for me.

then just call my enrollUser method in my userObj

   function enrollUser($site,$roll){
      Logger::$log->debug("UserObj():enrollUser( ".$site. " " . $roll . " );" );
      $accessUser = getAccessUser();
      $accessPassword = getAccessPassword();
      $contextType    = "application/json";
      $userUrl = "http://" . $_SERVER['SERVER_NAME'] . "/alfresco/service/api/sites/" . $site . "/memberships";
      switch ($roll) {
         case "SiteConsumer": break;
         case "SiteContributor": break;
         case "SiteCollaborator": break;
         case "SiteManager": break;
         default: return false;
      }

      $requestString = '{"person":  {"userName":"' . $this->userName . '"},"role":"'. $roll . '"}';

      $request = RestClient::post( $userUrl,
            $requestString,
            $accessUser,
            $accessPassword,
            $contextType);
      
      if ($request->getResponseCode() == '200' ) {
         return true;
      }else{
         return false;
      }


   }