If you know how to assign object permissions to a user it works the same
way. Use the role path where ever you would you the user path.   To put
add a user to a role you have to manipulate the "group-member-set"  (I
think) property of the role.  I know there is a Wiki example.  

-----Original Message-----
From: Gabriel Bermudez [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 06, 2005 2:41 PM
To: Slide Users Mailing List
Subject: Re: Unresolved problem with users and passwords

I forgot to ask something, creating a role is the same as creating a
user, that is creating a collecition under /slide/roles/ and setting up
the right properties?
How do you give permissions to certains collections to a role, for
example

/slide/
   |--files/new/
   |--roles/
            |--newRole/    <---the users associted to this role can
just read/write "/slide/new/"

Again has anyone done this with the slide client library, or even better
has some example code to use as base.

Thanks in advanced

2005/12/6, Gabriel Bermudez <[EMAIL PROTECTED]>:
> Hi,
> A lot of thanks for the pointer :)
> After struggling the whole morning with the problem I finally could 
> create a user with a password and set it to a role :) First of all I 
> am using the JCA connector to handle the connection and the 
> transaction.  I'm calling the code from the method of an EJB.
> Here is what I did:
>
> String host="http://127.0.0.1:8888/slide/";;
>                 //the next line get a connection using JNDI
>                 WebDAVConnection
connection=JBSCUtil.getWebDAVConnection(host);
>                 WebdavResource
resource=connection.getWebdavResource();
>                 //the variable login is the username
>                 resource.mkcolMethod("/slide/users/"+login);
>
>                 PropertyName pn=new
> PropertyName("http://jakarta.apache.org/slide/","password";);
>
resource.proppatchMethod("/slide/users/"+login,pn,password,true);
>                 resource.setPath("/slide/roles/user");
>                 Enumeration
propEnum=resource.propfindMethod("group-member-set");
>                 String val=(String)propEnum.nextElement();
>                 String newProp="<![CDATA[<D:href 
> xmlns:D='DAV:'>"+"/slide/users/"+login+"</D:href>\r\n"+val+"]]>";
>
>                 //this little part changes I create a new PropertyName

> with
> namespace=DAV: and tag=group-member-set
>                 pn=new PropertyName("DAV:","group-member-set");
>                 resource.proppatchMethod(pn,newProp,true);
>                 connection.close();
>
> Hope this helps anyone that has or will have the same problem.
> Again, thanks to Virgilio and Matias for the help given
>
> Regards
>
> 2005/12/5, Virgilio duce <[EMAIL PROTECTED]>:
> > I have created a new user using webdav library.Here my code:
> >
> > Enumeration enumProp;
> >    try {
> >                     // creates user
> >       String userDir= "/slide/slide/users/"+userName;
> >      webdavResource.mkcolMethod(userDir);
> >      webdavResource.setPath(userDir);
> >      PropertyName pn=new
> > PropertyName("http://jakarta.apache.org/slide/","password";);
> >      webdavResource.proppatchMethod(pn,password,true);
> >
> >      // Creating Xml of all existing user also
> >      String roleToAssign="/slide/slide/roles/"+role;
> >      System.out.println(roleToAssign);
> >      webdavResource.setPath(roleToAssign);
> >      enumProp = webdavResource.propfindMethod("group-member-set");
> >
> >      String val=(String)enumProp.nextElement();
> >      System.out.println("Group-member-set vale :"+val);
> >      String newProp= "<![CDATA[<D:href 
> > xmlns:D='DAV:'>"+userDir+"</D:href>"+val+"]]>";
> >
webdavResource.proppatchMethod("group-member-set",newProp,true);
> >     } catch (IOException e) {
> >
> >      e.printStackTrace();
> >     }
> >
> > I hope this can help you!!!
> >
> >
> > ----- Original Message -----
> > From: "Gabriel Bermudez" <[EMAIL PROTECTED]>
> > To: "Slide Users Mailing List" <[email protected]>
> > Sent: Monday, December 05, 2005 9:20 PM
> > Subject: Unresolved problem with users and passwords
> >
> >
> > Hi, I've been reading the users mailing list and searching the web 
> > but everywhere I read, seems to have the same problem.
> > To create a new user in slide, you have to create a colletion uner 
> > /slide/users with the user name, and then set a property with 
> > certain values, you can do it with third parties software like 
> > DAVExplorer, even the slide documentation has a little HOW-TO on 
> > that (jakarta.apache.org/slide/howto-create-users.html), but there 
> > is no WHO-TO example using the webdavclient library :( Was some one 
> > has done this already or you simple can't create users and set 
> > passwords with this library? Ive been trying to use the PropertyName

> > because the webdav command client uses it to set properties like 
> > this:
> >
> >     void proppatch(String path, String prop, String value)
> >     {
> >         String name=prop;
> >         try {
> >             path=checkUri(path);
> >             out.print("Putting property(" + name + ", " + value +
> >                 ") to '" + path + "': ");
> >             if (webdavResource.proppatchMethod(
> >                 path, new PropertyName("DAV:",name), value, true)) {
> >                 out.println("succeeded.");
> >             } else {
> >                 out.println("failed.");
> >                 out.println(webdavResource.getStatusMessage());
> >             }
> >         }
> >         catch (Exception ex) {
> >             handleException(ex);
> >         }
> >     }
> >
> > Has anyone had a sucessfull creation of a user with a password using

> > the webdavclient library, did you use the PropertyName class, can 
> > you give some sample code.
> > Thanks a lot for your help
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to