You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Alexey Bugayov <ab...@gmail.com> on 2005/08/17 11:25:53 UTC

New user creating.

Hi All,
I spent couple of days trying to create new user in SLIDE but without success.
I have read a lot of info in the mailing list and on the slide site
but didn't solve my pb.
See my code for new user creating below. There is no any error during
execution the code
and all data in the  .def.xml files look like ok.
But when I try to connect to SLIDE server with this created user I am
geting 403 Error.
May be somebody had the similiar situation and know how to solve it.

Any suggestion, comments welcome !

My environment: Win2K, Slide 2.1 bundled with Tomcat 5.0.28  with all
settings by default.


The code example:
    static void addUser() throws Exception
    {
        String ROOT_PATH = "/slide";
        String USERS_PATH = "/slide/users/";
        String ROLES_PATH = "/slide/roles/";
        String USERNAME = "testuser";
        String PSWD = "testuser";
        String PSWD_NAMESPACE = "http://jakarta.apache.org/slide/";
        String ROLE_NAMESPACE = "DAV:";
        String DDD = "<![CDATA[<D:href
xmlns:D='DAV:'>/users/"+USERNAME+"</D:href><D:href
xmlns:D='DAV:'>/users/john</D:href><D:href
xmlns:D='DAV:'>/users/john2</D:href><D:href
xmlns:D='DAV:'>/users/root</D:href><D:href
xmlns:D='DAV:'>/users/projector</D:href>]]>";

        org.apache.commons.httpclient.HttpURL hrl =
            new
org.apache.commons.httpclient.HttpURL("http://localhost:8080/slide/");
        hrl.setUserinfo("root","root");

        WebdavResource wdr = new WebdavResource(hrl);
        boolean res = false;

        PropertyName password_prop = new PropertyName(PSWD_NAMESPACE,
"password");
        PropertyName role_prop = new PropertyName(ROLE_NAMESPACE,
"group-member-set");

        //creating..
        //user
        res = wdr.mkcolMethod(USERS_PATH + USERNAME);
        System.out.println("user created: "+ res);

        //password
        wdr.setPath(USERS_PATH + USERNAME);
        res = wdr.proppatchMethod(password_prop, PSWD, true);
        System.out.println("password created: "+ res);

        //role
        wdr.setPath(ROLES_PATH);
        res = wdr.proppatchMethod(role_prop, DDD, true);
        System.out.println("role updated: "+ res);

        wdr.close();

    }

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org