Resource Menu


RE : create user
" I prefer to remove CreateUser function from the main page ..."

To remove the "CreateUser" action, go to web.xml in $LS_SRC_DIR/Src/LS-Client/Default-WebApp/WEB-INF/web.xml and find the block :

<!-- CreateUser -->
    <servlet>
        <servlet-name>CreateUser</servlet-name>
        <servlet-class>org.libresource.web.servlets.CreateUser</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>CreateUser</servlet-name>
        <url-pattern>/CreateUser</url-pattern>
    </servlet-mapping>

… and comment it :

<!-- CreateUser -->
    <!-- <servlet>
        <servlet-name>CreateUser</servlet-name>
        <servlet-class>org.libresource.web.servlets.CreateUser</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>CreateUser</servlet-name>
        <url-pattern>/CreateUser</url-pattern>
    </servlet-mapping> -->

Then, you need to re-compile and re-deploy the application.


" ...and to create users in the database by using a script."

The users are stored in the table " user_ " in the libresource database. You can display the description of the table with the following commands :

[libresource@localhost libresource]$  psql  libresource
libresource=# \d user_ 

username_ is the primary key (not null, unique).

password_digest_ is the md5 hash of the user password.

I give you a java class : here

This class will generate you the correct md5 hash for LibreSource :

libresource@localhost:~/md5$ ls
total 4
LSMD5Encoder.java
libresource@localhost:~/md5$ javac LSMD5Encoder.java
libresource@localhost:~/md5$ java LSMD5Encoder password
LS password hash for 'password' = 5f4dffffffcc3b5affffffa765ffffffd61dffffff8327ffffffdeffffffb8ffffff82ffffffcfffffff99
posted by Florent Jouille at Jun 9, 2006 9:49 AM