You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by vicent <fa...@alert-online.com> on 2013/04/15 19:17:11 UTC
Users privileges to create Node Types
Hello,
I need several users have privileges to create node types; but this is only
possible with admin user...
When i create a new user, i set your privileges with JCR_ALL, that contains
JCR_NODE_TYPE_MANAGEMENT. So, i hoped that worked, but not...
So, how i can make to give privileges to create node types with any user?
it's possible?
Regards
--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Users-privileges-to-create-Node-Types-tp4658252.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Users privileges to create Node Types
Posted by Angela Schreiber <an...@adobe.com>.
hi
> Sorry, i should have made reference
> i'm using jcr 2.0 and jackrabbit api 2.4.3., this not works in this version?
i don't remember when exactly that jsr333 functionality has been added.
but it should be easy to find out...
angela
> the "new PincipalImpl(user)" is because
> javax.jcr.security.AccessControlList.addAccessControlEntry(Principal
> principal, Privilege[] privileges), defines the first param as Principal.
>
> thanks
>
>
> Angela Schreiber-2 wrote
>> hi
>>
>> the only thing that looks odd is "new Principal(user)".
>> otherwise i don't see at a first glance why it shouldn't work
>> if you are using a recent version of jackrabbit...
>>
>> could you create another test along with
>> AbstractRepositoryOperationTest#testRegisterNodeTypeWithPrivilege
>> and run it with your setup?
>>
>> thanks
>> angela
>>
>> On 4/16/13 1:08 PM, vicent wrote:
>>> Hi Angela,
>>> Thanks for your replay.
>>>
>>> I tried to implement the solution, but not worked or i didn't
>>> understand....
>>>
>>> i tried the following:
>>>
>>> first, i create an user:
>>>
>>> User user = um.createUser(userName,password);
>>>
>>> define privileges:
>>>
>>> AccessControlManager aMgr = session.getAccessControlManager();
>>>
>>> Privilege[] privileges=new
>>> Privilege[]{aMgr.privilegeFromName(Privilege.JCR_ALL)};
>>>
>>> set grants (for the 'null' path):
>>>
>>> AccessControlList acl;
>>> try {
>>> acl = (AccessControlList)
>>> aMgr.getApplicablePolicies(null).nextAccessControlPolicy();
>>> } catch (NoSuchElementException e) {
>>> acl = (AccessControlList) aMgr.getPolicies(null)[0];
>>> }
>>>
>>> acl.addAccessControlEntry(new PrincipalImpl(user), privileges);
>>> aMgr.setPolicy(null, acl);
>>> session.save();
>>>
>>> So, what i doing wrong? :S
>>>
>>> Thanks
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://jackrabbit.510166.n4.nabble.com/Users-privileges-to-create-Node-Types-tp4658252p4658266.html
>>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>
>
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/Users-privileges-to-create-Node-Types-tp4658252p4658278.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Users privileges to create Node Types
Posted by vicent <fa...@alert-online.com>.
Hi
thanks again :)
Sorry, i should have made reference
i'm using jcr 2.0 and jackrabbit api 2.4.3., this not works in this version?
the "new PincipalImpl(user)" is because
javax.jcr.security.AccessControlList.addAccessControlEntry(Principal
principal, Privilege[] privileges), defines the first param as Principal.
thanks
Angela Schreiber-2 wrote
> hi
>
> the only thing that looks odd is "new Principal(user)".
> otherwise i don't see at a first glance why it shouldn't work
> if you are using a recent version of jackrabbit...
>
> could you create another test along with
> AbstractRepositoryOperationTest#testRegisterNodeTypeWithPrivilege
> and run it with your setup?
>
> thanks
> angela
>
> On 4/16/13 1:08 PM, vicent wrote:
>> Hi Angela,
>> Thanks for your replay.
>>
>> I tried to implement the solution, but not worked or i didn't
>> understand....
>>
>> i tried the following:
>>
>> first, i create an user:
>>
>> User user = um.createUser(userName,password);
>>
>> define privileges:
>>
>> AccessControlManager aMgr = session.getAccessControlManager();
>>
>> Privilege[] privileges=new
>> Privilege[]{aMgr.privilegeFromName(Privilege.JCR_ALL)};
>>
>> set grants (for the 'null' path):
>>
>> AccessControlList acl;
>> try {
>> acl = (AccessControlList)
>> aMgr.getApplicablePolicies(null).nextAccessControlPolicy();
>> } catch (NoSuchElementException e) {
>> acl = (AccessControlList) aMgr.getPolicies(null)[0];
>> }
>>
>> acl.addAccessControlEntry(new PrincipalImpl(user), privileges);
>> aMgr.setPolicy(null, acl);
>> session.save();
>>
>> So, what i doing wrong? :S
>>
>> Thanks
>>
>>
>>
>> --
>> View this message in context:
>> http://jackrabbit.510166.n4.nabble.com/Users-privileges-to-create-Node-Types-tp4658252p4658266.html
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Users-privileges-to-create-Node-Types-tp4658252p4658278.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Users privileges to create Node Types
Posted by Angela Schreiber <an...@adobe.com>.
hi
the only thing that looks odd is "new Principal(user)".
otherwise i don't see at a first glance why it shouldn't work
if you are using a recent version of jackrabbit...
could you create another test along with
AbstractRepositoryOperationTest#testRegisterNodeTypeWithPrivilege
and run it with your setup?
thanks
angela
On 4/16/13 1:08 PM, vicent wrote:
> Hi Angela,
> Thanks for your replay.
>
> I tried to implement the solution, but not worked or i didn't understand....
>
> i tried the following:
>
> first, i create an user:
>
> User user = um.createUser(userName,password);
>
> define privileges:
>
> AccessControlManager aMgr = session.getAccessControlManager();
>
> Privilege[] privileges=new
> Privilege[]{aMgr.privilegeFromName(Privilege.JCR_ALL)};
>
> set grants (for the 'null' path):
>
> AccessControlList acl;
> try {
> acl = (AccessControlList)
> aMgr.getApplicablePolicies(null).nextAccessControlPolicy();
> } catch (NoSuchElementException e) {
> acl = (AccessControlList) aMgr.getPolicies(null)[0];
> }
>
> acl.addAccessControlEntry(new PrincipalImpl(user), privileges);
> aMgr.setPolicy(null, acl);
> session.save();
>
> So, what i doing wrong? :S
>
> Thanks
>
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/Users-privileges-to-create-Node-Types-tp4658252p4658266.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Users privileges to create Node Types
Posted by vicent <fa...@alert-online.com>.
Hi Angela,
Thanks for your replay.
I tried to implement the solution, but not worked or i didn't understand....
i tried the following:
first, i create an user:
User user = um.createUser(userName,password);
define privileges:
AccessControlManager aMgr = session.getAccessControlManager();
Privilege[] privileges=new
Privilege[]{aMgr.privilegeFromName(Privilege.JCR_ALL)};
set grants (for the 'null' path):
AccessControlList acl;
try {
acl = (AccessControlList)
aMgr.getApplicablePolicies(null).nextAccessControlPolicy();
} catch (NoSuchElementException e) {
acl = (AccessControlList) aMgr.getPolicies(null)[0];
}
acl.addAccessControlEntry(new PrincipalImpl(user), privileges);
aMgr.setPolicy(null, acl);
session.save();
So, what i doing wrong? :S
Thanks
--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Users-privileges-to-create-Node-Types-tp4658252p4658266.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Users privileges to create Node Types
Posted by Angela Schreiber <an...@adobe.com>.
hi
that should work for any principal.
but please note that you have to grant the privilege for the 'null'
path as it is a repository level privilege.
for further information regarding passing 'null' to the various
methods on javax.jcr.AccessControlManager you may want to look at
JSR 333.
hope that helps
angela
On 4/15/13 7:17 PM, vicent wrote:
> Hello,
>
> I need several users have privileges to create node types; but this is only
> possible with admin user...
>
> When i create a new user, i set your privileges with JCR_ALL, that contains
> JCR_NODE_TYPE_MANAGEMENT. So, i hoped that worked, but not...
>
> So, how i can make to give privileges to create node types with any user?
> it's possible?
>
> Regards
>
>
>
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/Users-privileges-to-create-Node-Types-tp4658252.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.