jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Javier Arias <jar...@ujaen.es>
Subject Re: New information about my last email...
Date Mon, 17 Jan 2011 16:52:26 GMT
I have achieved change the admin password by this Java code:

Repository repository = new TransientRepository(new    
          File(_repositoryToConnect));

Session session = repository.login(new
SimpleCredentials("admin","admin");

UserManager userManager = ((JackrabbitSession)
session).getUserManager();

Authorizable authorizable = userManager.getAuthorizable("admin");
            
boolean admin = ((User) authorizable).isAdmin();

if (admin)
     {
           authorizable = userManager.getAuthorizable(user);
           ((User) authorizable).changePassword(newPassword);
     }

session.save();
session.logout();
--------------------------------------------------

And the code to create user:

Repository repository = new TransientRepository(new    
     File(_repositoryToConnect));
Session session = (SessionImpl) repository.login(new 
     SimpleCredentials("admin,"admin");

UserManager userManager = (UserManager) ((JackrabbitSession)
session).getUserManager();

Authorizable authorizable = userManager.getAuthorizable(_userDav);
boolean admin = ((User) authorizable).isAdmin();

if (admin)
     User createUser = userManager.createUser(newUser,newPassword);

session.save();
session.logout();
------------------------------------------------------
 
I am using the JackRabbit standalone.

El lun, 17-01-2011 a las 16:36 +0000, Alexander Klimetschek escribió:
> On 17.01.11 17:25, "Javier Arias" <jarias@ujaen.es> wrote:
> >I have achieved change admin password
> 
> How did you change it?
> 
> > and create a new user.  I can
> >loggin in the server if I do it from Java code. If a try it from browser
> >(for example, Mozilla using url: http//localhost:8080), I only can
> >looggin using admin/admin.
> 
> I suppose you are using the Jackrabbit standalone or the Jackrabbit webapp?
> 
> >This is a problem because is someone connect
> >to my machine in port 8080, he can read all files content the
> >repository.
> >
> >Another ask is, how can I give privileges to a new user for add files to
> >the repository?
> >
> >In the repository.xmlI am using  DefaultLogin and DeafultAccess
> 
> Setting ACLs is the way to go. See:
> 
> 
> http://www.day.com/specs/jcr/2.0/16_Access_Control_Management.html (JCR
> 2.0 spec)
> http://wiki.apache.org/jackrabbit/AccessControl
> http://markmail.org/message/utmhahj5naevqpat
> 
> Regards,
> Alex
> 




Mime
View raw message