Sling Repository Explorer

2009-03-07 Thread Valentin Jacquemin
Dear all,

I don't know if there are some dev about the Sling-based JCR explorer[1] but
I started a small prototype about it.

I hope it could be usefull for the newcomers on Sling as a sample app for
example. At least, to me it helped to learn some basic functionalities about
Sling.
So enough words, my prototype is here (I don't know the usual process to
propose a contribution, are there any repository available for the
non-comitters?):





ul li{
list-style-type: disc;
}



Sling Repository Explorer


<%
  function prt(nodePath, nodeName) { out.println("" +
nodeName + ""); }
var root = currentNode.session.getRootNode();
var nodes = root.getNodes("*");
for(n in nodes)
{
prt(nodes[n].getPath(), nodes[n].getName());
}
%>






(function(){
var folderTypes = ['SLING:FOLDER','NT:FOLDER', 'REP:SYSTEM'];
var isFolder = function(str){
for(var x in folderTypes)
{
if(str.toUpperCase() === folderTypes[x])
return true;
}
return false;
};
var loadChildren = function(path){
var query = new String(path);
  query = query.toString();
   var props = Sling.getContent(query,1,true);
   var str = '';
   var parent = document.getElementById(path);
   var hide = parent.childNodes.length != 1;
   for(p in props)
   {
   if(props[p] instanceof Object)
   {
   if(hide === true)
   {
   while(parent.childNodes.length != 1)
   {
   parent.removeChild(parent.lastChild);
   }
   }
   else
   {
  var ulEl = document.createElement('ul');
  var liEl = document.createElement('li');
  liEl.setAttribute('id', query + "/" + p);
  var t = document.createElement('a');
  t.setAttribute('href',
"javascript:Sling.Explorer.getProperties('"+path+"/"+p+"')");
  t.appendChild(document.createTextNode(p));
  liEl.appendChild(t);
  ulEl.appendChild(liEl);
  parent.appendChild(ulEl);
   }
   }
   str += p + ' : ' + props[p];
   }
};

Sling.Explorer = {
  getProperties: function(path){
var query = new String(path);
 var props = Sling.getContent(query.toString(),0,true);
 var str = '';
 for(p in props)
 {
 str += p + ' : ' + props[p];
 str += '
'; if(p == 'jcr:primaryType' && isFolder(props[p])) { loadChildren(path); } } var domProps = document.getElementById('properties'); domProps.innerHTML = str; } } })(); Any advices? Am I in the right direction With my best regards, Valentin Jacquemin [1] http://cwiki.apache.org/SLING/sling-based-jcr-explorer.html

[jira] Updated: (SLING-879) New Bundle to provide actions for interacting with the jackrabbit AccessManager

2009-03-07 Thread Eric Norman (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Norman updated SLING-879:
--

Attachment: (was: accessManager_patch.diff)

> New Bundle to provide actions for interacting with the jackrabbit 
> AccessManager
> ---
>
> Key: SLING-879
> URL: https://issues.apache.org/jira/browse/SLING-879
> Project: Sling
>  Issue Type: New Feature
>  Components: Servlets Get, Servlets Post
>Reporter: Eric Norman
>
> This is a new bundle that provides servlets to support modifying the 
> jackrabbit access control policies for JCR nodes.
> 1. The servlet bound to [nodePath].modifyAce.html can be invoked to add or 
> modify the access control privileges for a given principal.
> 2. The servlet bound to [nodePath].deleteAce.html can be invoked to remove 
> the access control entries for one or more principals.
> 3. The servlet bound to [nodePath].acl.json can be invoked to get a JSON 
> representation of the ACL for a node.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (SLING-879) New Bundle to provide actions for interacting with the jackrabbit AccessManager

2009-03-07 Thread Eric Norman (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Norman updated SLING-879:
--

Attachment: (was: org.apache.sling.jcr.jackrabbit.accessmanager.zip)

> New Bundle to provide actions for interacting with the jackrabbit 
> AccessManager
> ---
>
> Key: SLING-879
> URL: https://issues.apache.org/jira/browse/SLING-879
> Project: Sling
>  Issue Type: New Feature
>  Components: Servlets Get, Servlets Post
>Reporter: Eric Norman
>
> This is a new bundle that provides servlets to support modifying the 
> jackrabbit access control policies for JCR nodes.
> 1. The servlet bound to [nodePath].modifyAce.html can be invoked to add or 
> modify the access control privileges for a given principal.
> 2. The servlet bound to [nodePath].deleteAce.html can be invoked to remove 
> the access control entries for one or more principals.
> 3. The servlet bound to [nodePath].acl.json can be invoked to get a JSON 
> representation of the ACL for a node.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (SLING-879) New Bundle to provide actions for interacting with the jackrabbit AccessManager

2009-03-07 Thread Eric Norman (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Norman updated SLING-879:
--

Attachment: accessManager_patch.diff

updated patch to fix some minor issues + add some simple UI pages to the 
launchpad.content bundle

> New Bundle to provide actions for interacting with the jackrabbit 
> AccessManager
> ---
>
> Key: SLING-879
> URL: https://issues.apache.org/jira/browse/SLING-879
> Project: Sling
>  Issue Type: New Feature
>  Components: Servlets Get, Servlets Post
>Reporter: Eric Norman
> Attachments: accessManager_patch.diff, 
> org.apache.sling.jcr.jackrabbit.accessmanager.zip
>
>
> This is a new bundle that provides servlets to support modifying the 
> jackrabbit access control policies for JCR nodes.
> 1. The servlet bound to [nodePath].modifyAce.html can be invoked to add or 
> modify the access control privileges for a given principal.
> 2. The servlet bound to [nodePath].deleteAce.html can be invoked to remove 
> the access control entries for one or more principals.
> 3. The servlet bound to [nodePath].acl.json can be invoked to get a JSON 
> representation of the ACL for a node.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (SLING-879) New Bundle to provide actions for interacting with the jackrabbit AccessManager

2009-03-07 Thread Eric Norman (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Norman updated SLING-879:
--

Attachment: org.apache.sling.jcr.jackrabbit.accessmanager.zip

> New Bundle to provide actions for interacting with the jackrabbit 
> AccessManager
> ---
>
> Key: SLING-879
> URL: https://issues.apache.org/jira/browse/SLING-879
> Project: Sling
>  Issue Type: New Feature
>  Components: Servlets Get, Servlets Post
>Reporter: Eric Norman
> Attachments: accessManager_patch.diff, 
> org.apache.sling.jcr.jackrabbit.accessmanager.zip
>
>
> This is a new bundle that provides servlets to support modifying the 
> jackrabbit access control policies for JCR nodes.
> 1. The servlet bound to [nodePath].modifyAce.html can be invoked to add or 
> modify the access control privileges for a given principal.
> 2. The servlet bound to [nodePath].deleteAce.html can be invoked to remove 
> the access control entries for one or more principals.
> 3. The servlet bound to [nodePath].acl.json can be invoked to get a JSON 
> representation of the ACL for a node.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: How can I realize authentication in sling?

2009-03-07 Thread Eric Norman
Hi Felix,
My proposed changes for access control management are attached to
https://issues.apache.org/jira/browse/SLING-879

Let me know if you run into any troubles using it.

On Thu, Mar 5, 2009 at 1:52 PM, Felix Meschberger wrote:

> Hi Eric
>
> Eric Norman schrieb:
> > Hi yanjie,
> >
> > For my own project, I've implemented some custom sling POST handlers
> > (similar to the usermanager actions I contributed earlier) to
> > add/modify/delete access control entries for users/groups using the early
> > access JSR-283 access control support in jackrabbit 1.5.
> >
> > It seems to work well for my use cases, and I was planning on submitting
> a
> > patch when I get some free time to clean it up a bit.  If that is
> something
> > you would be interested in using, I can try to submit a patch for
> > consideration in the next few days.
>
> Yes, please, thanks ;-)
>
> Regards
> Felix
>
> >
> > -Eric
> >
> >
> > On Sun, Mar 1, 2009 at 7:16 PM, yanjie  wrote:
> >
> >> HI felix:
> >> Glad to recieve your answer ,
> >> I think it's important for a content manager system  to have
> authentication
> >> control.
> >> If there is no authenticatioin control , user management will be less
> >> useful.
> >> I think the users of sling really hope sling can add the
> authentication's
> >>  function early.
> >> waiting ...
> >>
> >> thanks.
> >>
> >>
> >> 2009-03-02
> >>
> >>
> >>
> >> yanjie
> >>
> >>
> >>
> >> 发件人: Felix Meschberger
> >> 发送时间: 2009-02-28  05:03:18
> >> 收件人: sling-dev
> >> 抄送:
> >> 主题: Re: How can I realize authentication in sling?
> >>
> >> Hi,
> >> yanjie schrieb:
> >>> Hi everyone:
> >>> I want to give a user some policy to handle a node(read or write or
> >> modify..) , and other users don't have the policy . Or a group has the
> >> policy and the users in the group all have the authentication . how can
> I
> >> use sling to realize it?
> >> Sling employs the authentication and access control functionality of the
> >> underlying JCR repository (Jackrabbit by default).
> >> So you have to create users and groups in Jackrabbit (I have applied the
> >> SLING-875 patches by Eric Norman today to enable user/group management
> >> in Sling.
> >> In addition you have to set access control in the repository. This is
> >> more problematic at the moment because Jackrabbit 1.5 embedded in Sling
> >> only contains partial support for JSR-283 (aka JCR 2.0) access control
> >> support.
> >> Maybe others on the list are more knowledgeable in this respect...
> >> Regards
> >> Felix
> >>
> >
>
>


[jira] Issue Comment Edited: (SLING-879) New Bundle to provide actions for interacting with the jackrabbit AccessManager

2009-03-07 Thread Eric Norman (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12679921#action_12679921
 ] 

edn edited comment on SLING-879 at 3/7/09 2:50 PM:
---

Part of the patch includes a couple of sample UI scripts for the 
lauchpad.content bundle to provide a starting point for some html UI to 
add/modify/delete access control entries.

It should work for any JCR node by using the '.acl.html' suffix on the url.


  was (Author: edn):
Part of the patch includes a couple of sample UI scripts for the 
lauchpad.content bundle to provide a starting point for some html UI 
add/modify/delete access control entries.

It should work for any JCR node by using the '.acl.html' suffix on the url.

  
> New Bundle to provide actions for interacting with the jackrabbit 
> AccessManager
> ---
>
> Key: SLING-879
> URL: https://issues.apache.org/jira/browse/SLING-879
> Project: Sling
>  Issue Type: New Feature
>  Components: Servlets Get, Servlets Post
>Reporter: Eric Norman
> Attachments: accessManager_patch.diff, 
> org.apache.sling.jcr.jackrabbit.accessmanager.zip
>
>
> This is a new bundle that provides servlets to support modifying the 
> jackrabbit access control policies for JCR nodes.
> 1. The servlet bound to [nodePath].modifyAce.html can be invoked to add or 
> modify the access control privileges for a given principal.
> 2. The servlet bound to [nodePath].deleteAce.html can be invoked to remove 
> the access control entries for one or more principals.
> 3. The servlet bound to [nodePath].acl.json can be invoked to get a JSON 
> representation of the ACL for a node.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-879) New Bundle to provide actions for interacting with the jackrabbit AccessManager

2009-03-07 Thread Eric Norman (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12679921#action_12679921
 ] 

Eric Norman commented on SLING-879:
---

Part of the patch includes a couple of sample UI scripts for the 
lauchpad.content bundle to provide a starting point for some html UI 
add/modify/delete access control entries.

It should work for any JCR node by using the '.acl.html' suffix on the url.


> New Bundle to provide actions for interacting with the jackrabbit 
> AccessManager
> ---
>
> Key: SLING-879
> URL: https://issues.apache.org/jira/browse/SLING-879
> Project: Sling
>  Issue Type: New Feature
>  Components: Servlets Get, Servlets Post
>Reporter: Eric Norman
> Attachments: accessManager_patch.diff, 
> org.apache.sling.jcr.jackrabbit.accessmanager.zip
>
>
> This is a new bundle that provides servlets to support modifying the 
> jackrabbit access control policies for JCR nodes.
> 1. The servlet bound to [nodePath].modifyAce.html can be invoked to add or 
> modify the access control privileges for a given principal.
> 2. The servlet bound to [nodePath].deleteAce.html can be invoked to remove 
> the access control entries for one or more principals.
> 3. The servlet bound to [nodePath].acl.json can be invoked to get a JSON 
> representation of the ACL for a node.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.