Attached is a patch for auto-create-users against version 2.0 of slide.

I've added the following methods to the Macro interfasce:

    /**
     * Adds a user.
     * 
     * @param root The token to use to create the user.
     * @param user The name of the user to create.
     * @throws MacroException If an exception occurs.
     */
    public void addUser(SlideToken root, String user) throws MacroException;
    
    /**
     * Adds a role.
     * 
     * @param root The token to use to create the role.
     * @param role The name of the role to create.
     * @throws MacroException If an exception occurs.
     */
    public void addRole(SlideToken root, String role) throws MacroException;
    
    /**
     * Add a user to a role.
     * 
     * @param root The token to use to perform the operation.
     * @param user The name of the user to add to the role.
     * @param role The role to add the user to.
     * @throws MacroException If an exception occurs.
     */
    public void addUserToRole(SlideToken root, String user, String role)
throws MacroException;
    
    /**
     * Removes a user from a role.
     * 
     * @param root The token to use to perform the operation.
     * @param user The name of the user to remove from the role.
     * @param role The role to remove the user from.
     * @throws MacroException If an exception occurs.
     */
    public void removeUserFromRole(SlideToken root, String user, String
role) throws MacroException;

And corresponding implementations to the MacroImpl class.

I haven't added methods to remove users and roles as this creates data
integrity issues.

The WebdavServlet has been modified to auto-create a user if configured to
do so.

The usage is as for the previous patch:

It is configured with the following properties in Domain.xml:

auto-create-users and
auto-create-users-role

These properties do not have the same definition as they did previously.

auto-create-users specifies the user to use to create new users, so it
must be a root user and auto-create-users-role specifies the role to add
the new user to. If this property is not specified the user will not be
added to any roles.

A typical configuration would be:

<configuration>
        ...
        <auto-create-users>root</auto-create-users>
        <auto-create-users-role>user</auto-create-users-role>
        ...
</configuration>

The root user will be used to create new users. New users will be added
to the user role.

Let me know what you think.

Jamie.

-----Original Message-----
From: Jamie Mortimore [mailto:[EMAIL PROTECTED]
Sent: 26 April 2004 13:06
To: Slide Users Mailing List
Subject: Re: patch for auto-create-users


On Mon, 2004-04-26 at 10:52, Martin Holz wrote:
> > I added a createUser method to the Content interface and implementation,
> > ContentImpl. You may decide this is not the right place for a create
> > user method if Content is only supposed to handle more low level
> > operations. In which case the functionality could be moved to the only
> > place createUser is called from - AbstractWebdavMethod.run.
> 
> I have been thinking about MacroImpl as the right place or a new
> helper for higher level user management.

Sounds good - I'll move the method(s) there.

> > The createUser method takes 3 parameters:
> > 
> > * root - The SlideToken to use to perform the necessary operations -
> > this should have the credentials of a root user in order to perform the
> > operations successfully.
> > * userName - The name of the new user.
> > * role - The role of the new user. Pass in null to create the user
> > without any roles.
> 
> Shouldn't this be a potentially empty list of roles?

Potentially yes. I didn't add support for lists of roles as the previous
version (if it had worked) didn't support it (not that that's a good
reason not to add it).

I was thinking about adding a set of methods along the lines of:

addUser
removeUser
addRole
removeRole
addUserToRole
removeUserFromRole

> > I modelled the createUser method around what I could gather was being
> > done in the XMLUnmarsheller during creation of users at startup.
> > 
> > The createUser method is only called from one place -
> > AbstractWebdavMethod.run. I am assuming this is an entry point for all
> > wedav methods. The first thing this method now does is:
> 
> The servlet would need it too, if it wants to create a directory
> listing for a GET on a collection.

Are you saying there is a way webdav methods are called that do not go
through AbstractWebdavMethod.run? Is there a more appropriate place to
call the createUser method (eg at the start of WebdavServlet.service)?

I'm going to be using slide on a project I'm working on at the moment
and can devote some time to fixing any problems that would effect this
project + any enhancements required.

Would it be helpful if I provide a patch that includes the above against
the latest cvs version of Slide? Obviously I don't want to spend time on
another patch if someone else is already looking at integrating this
functionality.

Jamie.


---------------------------------------------------------------------
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