Was this page helpful?

Update a Group's Users

    Description of the code sample

    The following code example updates group with ID 2 to contain users with ID 2 and 3:

    Sample Code

    Plug p = Plug.New("http://deki-hayes/@api/deki");
    p.At("users", "authenticate").WithCredentials("admin", "password").Get();
    XDoc usersDoc = new XDoc("users")
        .Start("user")
            .Attr("id", 2)
        .End()
        .Start("user")
            .Attr("id", 3)
        .End();
    p.At("groups", "2", "users").Put(usersDoc);

    Sample Response from executing Code

    <group id="2" href="http://deki-hayes/@api/deki/groups/2">
        <groupname>My Contributors Group</groupname> 
        <service.authentication id="1" href="http://deki-hayes/@api/deki/site/services/1" /> 
        <users count="2" href="http://deki-hayes/@api/deki/groups/2/users" /> 
        <permissions.group>
            <operations mask="1343">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS</operations> 
            <role id="4" href="http://deki-hayes/@api/deki/site/roles/4">Contributor</role> 
        </permissions.group>
    </group>

    Implementation notes 

    Add notes about requirements or config values

    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by