incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling Website > Managing users and groups (jackrabbit.usermanager)
Date Tue, 16 Feb 2010 11:10:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Managing+users+and+groups+%28jackrabbit.usermanager%29">Managing
users and groups (jackrabbit.usermanager)</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~fmeschbe">Felix
Meschberger</a>
    </h4>
     Add documentation on reading users and groups
          <div id="versionComment" class="noteMacro" style="display:none; padding: 5px;">
     Add documentation on reading users and groups<br />
     </div>
          <br/>
     <div class="notificationGreySide">
         <h1><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Managingusersandgroups"></a>Managing
users and groups</h1>

<p>The <tt>jackrabbit-usermanager</tt> bundle delivers a REST interface
to create, update and delete users and groups in the JCR. After installing the <tt>jackrabbit-usermanager</tt>
bundle all REST services are exposed under the path /system/userManager.</p>

<div>
<ul>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Listusers'>List
users</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Getuser'>Get
user</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Createuser'>Create
user</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Updateuser'>Update
user</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Changepassword'>Change
password</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Deleteuser'>Delete
user</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Listgroups'>List
groups</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Getgroup'>Get
group</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Creategroup'>Create
group</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Updategroup'>Update
group</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Deletegroup'>Delete
group</a></li>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-AutomatedTests'>Automated
Tests</a></li>
</ul></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Listusers"></a>List
users</h2>

<p>To list existing users a GET request to the <tt>/system/userManager/user</tt>
resource can be posted. Depending on the configuration of the Default GET Servlet and/or the
availability of a Servlet or Script handling the <tt>sling/users</tt> resource
type, a result may be delivered.</p>

<p>Example with curl and the default JSON rendering:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>$ curl http://localhost:8080/system/userManager/user.tidy.1.json
{
  "admin": {},
  "anonymous": {}
}
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Getuser"></a>Get
user</h2>

<p>The properties of a single user can be retrieved by sending a GET request to the
user's resource at <tt>/system/userManager/user/username</tt> where <em>username</em>
would be replaced with the name of the user.  Depending on the configuration of the Default
GET Servlet and/or the availability of a Servlet or Script handling the <tt>sling/user</tt>
resource type, a result may be delivered.</p>

<p>Example with curl and the default JSON rendering:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>$ curl http://localhost:8080/system/userManager/user/admin.tidy.1.json
{}
</pre>
</div></div>

<p>If a non-existing user is be requested a 404/NOT FOUND status is sent back.</p>


<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Createuser"></a>Create
user</h2>

<p>To create a new user POST a request to <tt>/system/userManager/user.create.html</tt>.
The following parameters are available:</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br clear="all" /> </th>
<th class='confluenceTh'> required <br clear="all" /> </th>
<th class='confluenceTh'> description <br clear="all" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :name <br clear="all" /> </td>
<td class='confluenceTd'> yes <br clear="all" /> </td>
<td class='confluenceTd'> The name of the new user <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> pwd <br clear="all" /> </td>
<td class='confluenceTd'> yes <br clear="all" /> </td>
<td class='confluenceTd'> The password of the new user <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> pwdConfirm <br clear="all" /> </td>
<td class='confluenceTd'> yes <br clear="all" /> </td>
<td class='confluenceTd'> The password of the new user (confirming the value of pwd)
<br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty&gt; <br clear="all" /> </td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> Additional parameters will be stored as node properties in
the JCR <br clear="all" /> </td>
</tr>
</tbody></table>
<p>Responses:</p>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> 200 </td>
<td class='confluenceTd'> Success, a redirect is sent to the users resource locator
with HTML describing status. </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br clear="all" /> </td>
<td class='confluenceTd'> Failure, including user already exists. HTML explains failure.
</td>
</tr>
</tbody></table>
<p>Example with curl:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>curl -F:name=myuser -Fpwd=password -FpwdConfirm=password -Fanyproperty1=value1
\
    http://localhost:8080/system/userManager/user.create.html
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Updateuser"></a>Update
user</h2>

<p>To update an existing user POST a request to <tt>/system/userManager/user/username.update.html</tt>.
You can NOT update the username or the password (see Change Password below) only the additional
properties are updateable through this URL. The following parameters are available:</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br clear="all" /> </th>
<th class='confluenceTh'> required <br clear="all" /> </th>
<th class='confluenceTh'> description <br clear="all" /> </th>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty&gt; <br clear="all" /> </td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> Additional parameters will be stored/updated as node properties
in the JCR <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty@Delete&gt; <br clear="all" />
</td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> Properties with @Delete at the end of the name will be deleted
in the JCR <br clear="all" /> </td>
</tr>
</tbody></table>
<p>Responses:</p>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> 200 </td>
<td class='confluenceTd'> Success, a redirect is sent to the users resource locator
with HTML describing status. </td>
</tr>
<tr>
<td class='confluenceTd'> 404 <br clear="all" /> </td>
<td class='confluenceTd'> User was not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br clear="all" /> </td>
<td class='confluenceTd'> Failure </td>
</tr>
</tbody></table>
<p>Example</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>curl -Fanyproperty1@Delete -Fproperty2=value2 \
    http://localhost:8080/system/userManager/user/myuser.update.html
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Changepassword"></a>Change
password</h2>

<p>To change a password of an existing user POST a request to <tt>/system/userManager/user/username.changePassword.html</tt>.
The following parameters are available:</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br clear="all" /> </th>
<th class='confluenceTh'> required <br clear="all" /> </th>
<th class='confluenceTh'> description <br clear="all" /> </th>
</tr>
<tr>
<td class='confluenceTd'> oldPwd <br clear="all" /> </td>
<td class='confluenceTd'> required <br clear="all" /> </td>
<td class='confluenceTd'> Old password <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> newPwd <br clear="all" /> </td>
<td class='confluenceTd'> required <br clear="all" /> </td>
<td class='confluenceTd'> New password <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> newPwdConfrm <br clear="all" /> </td>
<td class='confluenceTd'> required <br clear="all" /> </td>
<td class='confluenceTd'> New password (confirming the password of newPwd <br clear="all"
/> </td>
</tr>
</tbody></table>
<p>Responses:</p>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> 200 </td>
<td class='confluenceTd'> Success, sent with no body. </td>
</tr>
<tr>
<td class='confluenceTd'> 404 <br clear="all" /> </td>
<td class='confluenceTd'> User was not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br clear="all" /> </td>
<td class='confluenceTd'> Failure. HTML explains failure. </td>
</tr>
</tbody></table>
<p>Example</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>curl -FoldPwd=oldpassword -FnewPwd=newpassword =FnewPwdConfirm=newpassword \
    http://localhost:8080/system/userManager/user/myuser.changePassword.html
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Deleteuser"></a>Delete
user</h2>

<p>To delete an existing user POST a request to <tt>/system/userManager/user/username.delete.html</tt>.
The following parameters are available:</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br clear="all" /> </th>
<th class='confluenceTh'> required <br clear="all" /> </th>
<th class='confluenceTh'> description <br clear="all" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :applyTo <br clear="all" /> </td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> An array of relative resource references to users to be deleted.
If this parameter is present, the username from the URL is ignored and all listed users are
removed. <br clear="all" /> </td>
</tr>
</tbody></table>
<p>Responses:</p>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> 200 </td>
<td class='confluenceTd'> Success, sent with no body. </td>
</tr>
<tr>
<td class='confluenceTd'> 404 <br clear="all" /> </td>
<td class='confluenceTd'> User(s) was/were not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br clear="all" /> </td>
<td class='confluenceTd'> Failure. HTML explains failure. </td>
</tr>
</tbody></table>
<p>Example</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>curl -Fgo=1 http://localhost:8080/system/userManager/user/myuser.delete.html
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Listgroups"></a>List
groups</h2>

<p>To list existing groups a GET request to the <tt>/system/userManager/group</tt>
resource can be sent. Depending on the configuration of the Default GET Servlet and/or the
availability of a Servlet or Script handling the <tt>sling/groups</tt> resource
type, a result may be delivered.</p>

<p>Example with curl and the default JSON rendering:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>$ curl http://localhost:8080/system/userManager/group.tidy.1.json
{
  "UserAdmin": {},
  "GroupAdmin": {},
  "administrators": {}
}
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Getgroup"></a>Get
group</h2>

<p>The properties of a single group can be retrieved by sending a GET request to the
group's resource at <tt>/system/userManager/group/groupname</tt> where <em>groupname</em>
would be replaced with the name of the group.  Depending on the configuration of the Default
GET Servlet and/or the availability of a Servlet or Script handling the <tt>sling/group</tt>
resource type, a result may be delivered.</p>

<p>Example with curl and the default JSON rendering:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>$ curl http://localhost:8080/system/userManager/group/administrators.tidy.1.json
{}
</pre>
</div></div>

<p>If a non-existing group is be requested a 404/NOT FOUND status is sent back.</p>


<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Creategroup"></a>Create
group</h2>

<p>To create a new group POST a request to <tt>/system/userManager/group.create.html</tt>.
The following parameters are available:</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br clear="all" /> </th>
<th class='confluenceTh'> required <br clear="all" /> </th>
<th class='confluenceTh'> description <br clear="all" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :name <br clear="all" /> </td>
<td class='confluenceTd'> yes <br clear="all" /> </td>
<td class='confluenceTd'> The name of the new group <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty&gt; <br clear="all" /> </td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> Additional parameters will be stored as node properties in
the JCR <br clear="all" /> </td>
</tr>
</tbody></table>
<p>Responses:</p>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> 200 </td>
<td class='confluenceTd'> Success, a redirect is sent to the group resource locator
with HTML describing status. </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br clear="all" /> </td>
<td class='confluenceTd'> Failure, including group already exists. HTML explains failure.
</td>
</tr>
</tbody></table>
<p>Example with curl:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>curl -F:name=mygroup -Fanyproperty1=value1 \
    http://localhost:8080/system/userManager/group.create.html
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Updategroup"></a>Update
group</h2>

<p>To update an existing group POST a request to <tt>/system/userManager/group/groupname.update.html</tt>.
You can NOT update the name of the group only the additional properties are updateable. The
following parameters are available:</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br clear="all" /> </th>
<th class='confluenceTh'> required <br clear="all" /> </th>
<th class='confluenceTh'> description <br clear="all" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :member <br clear="all" /> </td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> user(s) (name or URI) to add to the group as a member. Can
also be an array of users. <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> :member@Delete <br clear="all" /> </td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> user(s) (name or URI) to remove from the group. Can also be
an array of users. <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty&gt; <br clear="all" /> </td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> Additional parameters will be stored/updated as node properties
in the JCR <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty@Delete&gt; <br clear="all" />
</td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> Properties with @Delete at the end of the name will be deleted
in the JCR <br clear="all" /> </td>
</tr>
</tbody></table>
<p>Responses:</p>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> 200 </td>
<td class='confluenceTd'> Success, a redirect is sent to the groups resource locator
with HTML describing status. </td>
</tr>
<tr>
<td class='confluenceTd'> 404 <br clear="all" /> </td>
<td class='confluenceTd'> Group was not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br clear="all" /> </td>
<td class='confluenceTd'> Failure </td>
</tr>
</tbody></table>
<p>Example</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>curl \-Fanyproperty1@Delete \-Fproperty2=value2 -F ":member=/system/userManager/user/myuser"
\
    http://localhost:8080/system/userManager/group/mygroup.update.html
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Deletegroup"></a>Delete
group</h2>

<p>To delete an existing group POST a request to <tt>/system/userManager/group/groupname.delete.html</tt>.
The following parameters are available:</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br clear="all" /> </th>
<th class='confluenceTh'> required <br clear="all" /> </th>
<th class='confluenceTh'> description <br clear="all" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :applyTo <br clear="all" /> </td>
<td class='confluenceTd'> optional <br clear="all" /> </td>
<td class='confluenceTd'> An array of relative resource references to groups to be deleted.
If this parameter is present, the name of the group from the URL is ignored and all listed
groups are removed. <br clear="all" /> </td>
</tr>
</tbody></table>
<p>Responses:</p>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> 200 </td>
<td class='confluenceTd'> Success, sent with no body. </td>
</tr>
<tr>
<td class='confluenceTd'> 404 <br clear="all" /> </td>
<td class='confluenceTd'> Group(s) was/were not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br clear="all" /> </td>
<td class='confluenceTd'> Failure. HTML explains failure. </td>
</tr>
</tbody></table>
<p>Example</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>curl -Fgo=1 http://localhost:8080/system/userManager/group/mygroup.delete.html
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-AutomatedTests"></a>Automated
Tests</h2>

<p>The <a href="http://svn.apache.org/repos/asf/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/accessManager/"
rel="nofollow">launchpad/testing</a> module contains test classes for various operations
of the <tt>jackrabbit-usermanager</tt>. Such tests run as part of our continuous
integration process, to demonstrate and verify the behavior of the various operations, in
a way that's guaranteed to be in sync with the actual Sling core code. If you have an idea
for additional tests, make sure to let us know&#33;</p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Managing+users+and+groups+%28jackrabbit.usermanager%29">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=2329984&revisedVersion=7&originalVersion=6">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Managing+users+and+groups+%28jackrabbit.usermanager%29?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message