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.

Reply via email to