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 Sat, 19 Jun 2010 02:17:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://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="https://cwiki.apache.org/confluence/display/~justinedelson">Justin
Edelson</a>
    </h4>
        <br/>
                         <h4>Changes (15)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >$ curl http://localhost:8080/system/userManager/user.tidy.1.json
<br>{ <br></td></tr>
            <tr><td class="diff-changed-lines" >&quot;admin&quot;: <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{},</span>
<span class="diff-added-words"style="background-color: #dfd;">{</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
   &quot;memberOf&quot;: [], <br>    &quot;declaredMemberOf&quot;: []
<br>  }, <br></td></tr>
            <tr><td class="diff-changed-lines" >&quot;anonymous&quot;:
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{}</span>
<span class="diff-added-words"style="background-color: #dfd;">{</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
   &quot;memberOf&quot;: [], <br>    &quot;declaredMemberOf&quot;: []
<br>  } <br></td></tr>
            <tr><td class="diff-unchanged" >} <br>{noformat} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br>$ curl http://localhost:8080/system/userManager/user/admin.tidy.1.json
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{}</span>
<span class="diff-added-words"style="background-color: #dfd;">{</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
   &quot;memberOf&quot;: [], <br>    &quot;declaredMemberOf&quot;: []
<br>} <br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >$ curl http://localhost:8080/system/userManager/group.tidy.1.json
<br>{ <br></td></tr>
            <tr><td class="diff-changed-lines" >&quot;UserAdmin&quot;:
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{},</span>
<span class="diff-added-words"style="background-color: #dfd;">{</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
   &quot;members&quot;: [], <br>    &quot;declaredMembers&quot;: [],
<br>    &quot;memberOf&quot;: [], <br>    &quot;declaredMemberOf&quot;:
[] <br>  }, <br></td></tr>
            <tr><td class="diff-changed-lines" >&quot;GroupAdmin&quot;:
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{},</span>
<span class="diff-added-words"style="background-color: #dfd;">{</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
   &quot;members&quot;: [], <br>    &quot;declaredMembers&quot;: [],
<br>    &quot;memberOf&quot;: [], <br>    &quot;declaredMemberOf&quot;:
[] <br>   }, <br></td></tr>
            <tr><td class="diff-changed-lines" >&quot;administrators&quot;:
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{}</span>
<span class="diff-added-words"style="background-color: #dfd;">{</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
   &quot;members&quot;: [], <br>    &quot;declaredMembers&quot;: [],
<br>    &quot;memberOf&quot;: [], <br>    &quot;declaredMemberOf&quot;:
[] <br></td></tr>
            <tr><td class="diff-unchanged" >} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">}
<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br>$ curl http://localhost:8080/system/userManager/group/administrators.tidy.1.json
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{}</span>
<span class="diff-added-words"style="background-color: #dfd;">{</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
   &quot;members&quot;: [], <br>    &quot;declaredMembers&quot;: [],
<br>    &quot;memberOf&quot;: [], <br>    &quot;declaredMemberOf&quot;:
[] <br>} <br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <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>
    <li><a href='#Managingusersandgroups%28jackrabbit.usermanager%29-Permissionscheckingfromscripts'>Permissions
checking from scripts</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": {
    "memberOf": [],
    "declaredMemberOf": []
  },
  "anonymous": {
    "memberOf": [],
    "declaredMemberOf": []
  }
}
</pre>
</div></div>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Getuser"></a>Get
user</h2>
<p><em>since version 2.0.8</em><br/>
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
{
    "memberOf": [],
    "declaredMemberOf": []
}
</pre>
</div></div>

<p>If a non-existing user is 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>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> required <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> description <br class="atl-forced-newline" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :name <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> yes <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> The name of the new user <br class="atl-forced-newline"
/> </td>
</tr>
<tr>
<td class='confluenceTd'> pwd <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> yes <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> The password of the new user <br class="atl-forced-newline"
/> </td>
</tr>
<tr>
<td class='confluenceTd'> pwdConfirm <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> yes <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> The password of the new user (confirming the value of pwd)
<br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty&gt; <br class="atl-forced-newline"
/> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Additional parameters will be stored as node properties in
the JCR <br class="atl-forced-newline" /> </td>
</tr>
</tbody></table>
</div>

<p>Responses:</p>
<div class='table-wrap'>
<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 class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Failure, including user already exists. HTML explains failure.
</td>
</tr>
</tbody></table>
</div>

<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>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> required <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> description <br class="atl-forced-newline" /> </th>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty&gt; <br class="atl-forced-newline"
/> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Additional parameters will be stored/updated as node properties
in the JCR <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty@Delete&gt; <br class="atl-forced-newline"
/> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Properties with @Delete at the end of the name will be deleted
in the JCR <br class="atl-forced-newline" /> </td>
</tr>
</tbody></table>
</div>

<p>Responses:</p>
<div class='table-wrap'>
<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 class="atl-forced-newline" /> </td>
<td class='confluenceTd'> User was not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Failure </td>
</tr>
</tbody></table>
</div>

<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>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> required <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> description <br class="atl-forced-newline" /> </th>
</tr>
<tr>
<td class='confluenceTd'> oldPwd <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> required <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Old password <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td class='confluenceTd'> newPwd <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> required <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> New password <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td class='confluenceTd'> newPwdConfrm <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> required <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> New password (confirming the password of newPwd <br class="atl-forced-newline"
/> </td>
</tr>
</tbody></table>
</div>

<p>Responses:</p>
<div class='table-wrap'>
<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 class="atl-forced-newline" /> </td>
<td class='confluenceTd'> User was not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Failure. HTML explains failure. </td>
</tr>
</tbody></table>
</div>

<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>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> required <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> description <br class="atl-forced-newline" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :applyTo <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </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 class="atl-forced-newline" /> </td>
</tr>
</tbody></table>
</div>

<p>Responses:</p>
<div class='table-wrap'>
<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 class="atl-forced-newline" /> </td>
<td class='confluenceTd'> User(s) was/were not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Failure. HTML explains failure. </td>
</tr>
</tbody></table>
</div>

<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": {
    "members": [],
    "declaredMembers": [],
    "memberOf": [],
    "declaredMemberOf": []
  },
  "GroupAdmin": {
    "members": [],
    "declaredMembers": [],
    "memberOf": [],
    "declaredMemberOf": []
   },
  "administrators": {
    "members": [],
    "declaredMembers": [],
    "memberOf": [],
    "declaredMemberOf": []
}
}
</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
{
    "members": [],
    "declaredMembers": [],
    "memberOf": [],
    "declaredMemberOf": []
}
</pre>
</div></div>

<p>If a non-existing group is 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>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> required <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> description <br class="atl-forced-newline" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :name <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> yes <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> The name of the new group <br class="atl-forced-newline"
/> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty&gt; <br class="atl-forced-newline"
/> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Additional parameters will be stored as node properties in
the JCR <br class="atl-forced-newline" /> </td>
</tr>
</tbody></table>
</div>

<p>Responses:</p>
<div class='table-wrap'>
<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 class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Failure, including group already exists. HTML explains failure.
</td>
</tr>
</tbody></table>
</div>

<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>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> required <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> description <br class="atl-forced-newline" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :member <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </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 class="atl-forced-newline" /> </td>
</tr>
<tr>
<td class='confluenceTd'> :member@Delete <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> user(s) (name or URI) to remove from the group. Can also be
an array of users. <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty&gt; <br class="atl-forced-newline"
/> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Additional parameters will be stored/updated as node properties
in the JCR <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td class='confluenceTd'> &lt;anyproperty@Delete&gt; <br class="atl-forced-newline"
/> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Properties with @Delete at the end of the name will be deleted
in the JCR <br class="atl-forced-newline" /> </td>
</tr>
</tbody></table>
</div>

<p>Responses:</p>
<div class='table-wrap'>
<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 class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Group was not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Failure </td>
</tr>
</tbody></table>
</div>

<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>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> parameter name <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> required <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> description <br class="atl-forced-newline" /> </th>
</tr>
<tr>
<td class='confluenceTd'> :applyTo <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> optional <br class="atl-forced-newline" /> </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 class="atl-forced-newline" /> </td>
</tr>
</tbody></table>
</div>

<p>Responses:</p>
<div class='table-wrap'>
<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 class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Group(s) was/were not found </td>
</tr>
<tr>
<td class='confluenceTd'> 500 <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> Failure. HTML explains failure. </td>
</tr>
</tbody></table>
</div>

<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/"
class="external-link" 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>

<h2><a name="Managingusersandgroups%28jackrabbit.usermanager%29-Permissionscheckingfromscripts"></a>Permissions
checking from scripts</h2>

<p><em>Since Version 2.0.6</em></p>

<p>When developing scripts that will perform user or group updates, you may want to
know what actions the current user is provisioned to do.  This information can be used to
conditionally render parts of your page differently based on the user rights.</p>

<p>The jackrabbit.usermanager bundle provides a service (AuthorizablePrivilegesInfo)
you can utilize to do help with this permission checking.</p>

<p>The AuthorizablePrivilegesInfo provides methods for checking the following actions</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Method </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> canAddUser(jcrSession) </td>
<td class='confluenceTd'> Checks if the current user may add new users </td>
</tr>
<tr>
<td class='confluenceTd'> canAddGroup(jcrSession) </td>
<td class='confluenceTd'> Checks if the current user may add new groups </td>
</tr>
<tr>
<td class='confluenceTd'> canUpdateProperties(jcrSession, principalId) </td>
<td class='confluenceTd'> Checks if the current user may update the properties of the
specified principal </td>
</tr>
<tr>
<td class='confluenceTd'> canRemove(jcrSession, principalId) </td>
<td class='confluenceTd'> Checks if the current user may remove the specified user or
group </td>
</tr>
<tr>
<td class='confluenceTd'> canUpdateGroupMembers(jcrSession, groupId) </td>
<td class='confluenceTd'> Checks if the current user may modify the membership of the
specified group </td>
</tr>
</tbody></table>
</div>



<p>Example:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;%
    <span class="code-comment">// lookup the service
</span>    <span class="code-keyword">var</span> privilegesInfo = sling.getService(Packages.org.apache.sling.jackrabbit.usermanager.AuthorizablePrivilegesInfo);

    <span class="code-keyword">if</span> (privilegesInfo.canAddUser(currentSession))
{
        <span class="code-comment">//TODO: render the UI that allows the user to add
a user here
</span>    }

    <span class="code-keyword">if</span> (privilegesInfo.canAddGroup(currentSession))
{
        <span class="code-comment">//TODO: render the UI that allows the user to add
a group here
</span>    }

    <span class="code-keyword">if</span> (privilegesInfo.canUpdateProperties(currentSession,
<span class="code-quote">"someUserId"</span>)) {
        <span class="code-comment">//TODO: render the UI that allows the user to update
the properties of the user here
</span>    }

    <span class="code-keyword">if</span> (privilegesInfo.canRemove(currentSession,
<span class="code-quote">"someUserId"</span>)) {
        <span class="code-comment">//TODO: render the UI that allows the user to remove
the user here
</span>    }

    <span class="code-keyword">if</span> (privilegesInfo.canUpdateGroupMembers(currentSession,
<span class="code-quote">"GroupName"</span>)) {
        <span class="code-comment">//TODO: draw your UI that allows the user to update
the group memebership here
</span>    }
%&gt;
</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Managing+users+and+groups+%28jackrabbit.usermanager%29">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=2329984&revisedVersion=10&originalVersion=9">View
Changes</a>
                |
        <a href="https://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