Alfresco Add User In Sites with cURL


Sometime you need to add a user or more to one or many site in your Alfresco Share without web interface or without sending invitation.

Every site have some predefined roles:  "SiteManager", "SiteCollaborator", "SiteContributor", "SiteConsumer" .
(http://docs.alfresco.com/community/references/permissions_share.html)

Prerequisites:

1. site ID
2. username(s)
3. role type
4. cURL


I want to add an user test_user in site "My Test Site" with site ID "mytestsite" with Consumer role:

curl -X POST -uadmin:password "http://alfresco:8080/alfresco/service/api/sites/mytestsite/memberships" -H"content-type: application/json" -d "{"role":"SiteConsumer","person":{"userName" : "test_user"}}"


If all is OK the server respond with:

{
        "role": "SiteConsumer",
        "authority":
        {
                "authorityType": "USER",
                "fullName": "test_user",
                "userName": "test_user",
                "firstName": "User",
                "lastName": "Test",
                "jobtitle": "Job Test",
                "organization": "IN TESTing",
                "url": "\/alfresco\/service\/api\/people\/test_user"
        },
        "url": "\/alfresco\/service\/api\/sites\/mytestsite\/memberships\/test_user"
}




Comentarii

Postări populare de pe acest blog

SmokePing integrate with Observium