hi 

but you are casting to a particular session implementation.
how do you expect this to work in a different repository impl?

the interface that is exposing the 'getUserManager()' method
is called 'JackrabbitSession' and forms part of the Jackrabbit API.

so... maybe you want consider something like

if (session instanceof JackrabbitSession) {
   UserManager uMgr = ((JackrabbitSession) session).getUserManager();
   ....
} 

regards
angela

On 21/01/15 17:17, "Mike Nimer" <[email protected]> wrote:

>Using a JCR Repository instance, I did it this way
>
>----------------------------
>
>session = repository.login(new SimpleCredentials(_adminUserId,
>_adminPassword.toCharArray()));
>
>UserManager userManager = ((SessionImpl) session).getUserManager();
>
>// Create User
>String username = "test-user";
>User _user = userManager.createUser(username, "test-password");
>_user.setProperty("foo", session.getValueFactory().createValue("bar"));
>session.save();
>
>----------------------------
>
>I'd love to know if there are other/better ways to manage users? Or how to
>do it with an Oak Repository instance.
>
>hope this helps,
>--mike
>
>
>
>On Tue, Jan 20, 2015 at 11:15 PM, Raymond Boswel <[email protected]>
>wrote:
>
>> Hi Team,
>>
>> I feel like this should be really obvious, but I can't find this
>>documented
>> anywhere. At the moment I've figured out how to do most of what I want
>>to
>> accomplish with Oak, but I do everything logged in as the default admin
>> user. What is the correct way to define a new user for the oak repo?
>>
>> Thanks for all the good work :)
>>
>> Kind regards,
>> Raymond Boswel
>>

Reply via email to