You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Branden Visser <br...@uwindsor.ca> on 2009/09/26 02:09:34 UTC
Performing operations when user is created
Hi all,
I need to create some content and modify some permissions when a new user is created with the jackrabbit.usermanagement bundle. Would events be the right way to go here, or should I extend the 'Create User' servlet?
Can anyone provide some online references for doing this kind of thing?
Thanks,
Branden
Re: Performing operations when user is created
Posted by Branden Visser <br...@uwindsor.ca>.
Thanks Ian, I had a feeling Sakai3 probably handled this already.
I think it would be a useful addition to Sling.. are there any objections to pushing it in to the user-management bundle? Pre- and Post- processor hooks for other types of user operations might have valid use cases as well.
Thanks,
Branden
-----Ian Boston <ia...@googlemail.com> wrote: -----
To: dev@sling.apache.org
From: Ian Boston <ie...@tfd.co.uk>
Sent by: Ian Boston <ia...@googlemail.com>
Date: 09/27/2009 04:09AM
Subject: Re: Performing operations when user is created
On 26 Sep 2009, at 14:53, Branden Visser wrote:
> Ahh, if events run asynchronously, I think I will need something
> else. The user will need this content created for the very next
> request, if it's not there they will receive some ugly stack traces.
> It's a personal "dashboard" view.
>
> Does something new (e.g., a list of registered "user management
> observers") have to be implemented to do this?
We did this in Sakai by adding a UserPostProcessor [1] bound into
modified the user management servlets [2], on the assumption that we
were going to force all user creation to happen through REST or put
the hooks in. We found that async observations didnt work for use
(because they were async) and attaching to the internal Jackrabbit
sync events was just bad as it meant mods inside the server bundle.
Happy to clean up the approach and push to Sling, or you could grab
the bundle as is and repackage your launchpad.
Ian
1 http://github.com/ieb/open-experiments/blob/master/slingtests/osgikernel/bundles/user/src/main/java/org/sakaiproject/kernel/api/user/UserPostProcessor.java
2 http://github.com/ieb/open-experiments/blob/master/slingtests/osgikernel/bundles/user/src/main/java/org/sakaiproject/kernel/user/servlet/CreateSakaiUserServlet.java
>
> Thanks,
> ------------------------------------------
> Branden Visser
> LMS Application Programmer - Information Systems Services
> Information Technology Services
> University of Windsor
>
> -----Bertrand Delacretaz <bd...@apache.org> wrote: -----
>
> To: dev@sling.apache.org
> From: Bertrand Delacretaz <bd...@apache.org>
> Date: 09/26/2009 03:49AM
> Subject: Re: Performing operations when user is created
>
> Hi Branden,
>
> On Sat, Sep 26, 2009 at 2:09 AM, Branden Visser
> <br...@uwindsor.ca> wrote:
>> I need to create some content and modify some permissions when a
>> new user is created with the
>> jackrabbit.usermanagement bundle. Would events be the right way to
>> go here, or should I extend
>> the 'Create User' servlet?
>
> I don't know the usermanagement code well, but if your operations can
> be asynchronous, the simplest thing would be to register a listener
> for parts of the repository that the usermanagement modifies, and act
> according to events received.
>
>> Can anyone provide some online references for doing this kind of
>> thing?
>
> The thumbnail generator of the espblog sample [1] works like that.
>
> -Bertrand
>
> [1] http://svn.apache.org/repos/asf/sling/trunk/samples/espblog/src/main/java/org/apache/sling/samples/espblog/internal/ThumbnailGeneratorServiceImpl.java
Re: Performing operations when user is created
Posted by Ian Boston <ie...@tfd.co.uk>.
On 26 Sep 2009, at 14:53, Branden Visser wrote:
> Ahh, if events run asynchronously, I think I will need something
> else. The user will need this content created for the very next
> request, if it's not there they will receive some ugly stack traces.
> It's a personal "dashboard" view.
>
> Does something new (e.g., a list of registered "user management
> observers") have to be implemented to do this?
We did this in Sakai by adding a UserPostProcessor [1] bound into
modified the user management servlets [2], on the assumption that we
were going to force all user creation to happen through REST or put
the hooks in. We found that async observations didnt work for use
(because they were async) and attaching to the internal Jackrabbit
sync events was just bad as it meant mods inside the server bundle.
Happy to clean up the approach and push to Sling, or you could grab
the bundle as is and repackage your launchpad.
Ian
1 http://github.com/ieb/open-experiments/blob/master/slingtests/osgikernel/bundles/user/src/main/java/org/sakaiproject/kernel/api/user/UserPostProcessor.java
2 http://github.com/ieb/open-experiments/blob/master/slingtests/osgikernel/bundles/user/src/main/java/org/sakaiproject/kernel/user/servlet/CreateSakaiUserServlet.java
>
> Thanks,
> ------------------------------------------
> Branden Visser
> LMS Application Programmer - Information Systems Services
> Information Technology Services
> University of Windsor
>
> -----Bertrand Delacretaz <bd...@apache.org> wrote: -----
>
> To: dev@sling.apache.org
> From: Bertrand Delacretaz <bd...@apache.org>
> Date: 09/26/2009 03:49AM
> Subject: Re: Performing operations when user is created
>
> Hi Branden,
>
> On Sat, Sep 26, 2009 at 2:09 AM, Branden Visser
> <br...@uwindsor.ca> wrote:
>> I need to create some content and modify some permissions when a
>> new user is created with the
>> jackrabbit.usermanagement bundle. Would events be the right way to
>> go here, or should I extend
>> the 'Create User' servlet?
>
> I don't know the usermanagement code well, but if your operations can
> be asynchronous, the simplest thing would be to register a listener
> for parts of the repository that the usermanagement modifies, and act
> according to events received.
>
>> Can anyone provide some online references for doing this kind of
>> thing?
>
> The thumbnail generator of the espblog sample [1] works like that.
>
> -Bertrand
>
> [1] http://svn.apache.org/repos/asf/sling/trunk/samples/espblog/src/main/java/org/apache/sling/samples/espblog/internal/ThumbnailGeneratorServiceImpl.java
Re: Performing operations when user is created
Posted by Branden Visser <br...@uwindsor.ca>.
Ahh, if events run asynchronously, I think I will need something else. The user will need this content created for the very next request, if it's not there they will receive some ugly stack traces. It's a personal "dashboard" view.
Does something new (e.g., a list of registered "user management observers") have to be implemented to do this?
Thanks,
------------------------------------------
Branden Visser
LMS Application Programmer - Information Systems Services
Information Technology Services
University of Windsor
-----Bertrand Delacretaz <bd...@apache.org> wrote: -----
To: dev@sling.apache.org
From: Bertrand Delacretaz <bd...@apache.org>
Date: 09/26/2009 03:49AM
Subject: Re: Performing operations when user is created
Hi Branden,
On Sat, Sep 26, 2009 at 2:09 AM, Branden Visser <br...@uwindsor.ca> wrote:
> I need to create some content and modify some permissions when a new user is created with the
> jackrabbit.usermanagement bundle. Would events be the right way to go here, or should I extend
> the 'Create User' servlet?
I don't know the usermanagement code well, but if your operations can
be asynchronous, the simplest thing would be to register a listener
for parts of the repository that the usermanagement modifies, and act
according to events received.
> Can anyone provide some online references for doing this kind of thing?
The thumbnail generator of the espblog sample [1] works like that.
-Bertrand
[1] http://svn.apache.org/repos/asf/sling/trunk/samples/espblog/src/main/java/org/apache/sling/samples/espblog/internal/ThumbnailGeneratorServiceImpl.java
Re: Performing operations when user is created
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Branden,
On Sat, Sep 26, 2009 at 2:09 AM, Branden Visser <br...@uwindsor.ca> wrote:
> I need to create some content and modify some permissions when a new user is created with the
> jackrabbit.usermanagement bundle. Would events be the right way to go here, or should I extend
> the 'Create User' servlet?
I don't know the usermanagement code well, but if your operations can
be asynchronous, the simplest thing would be to register a listener
for parts of the repository that the usermanagement modifies, and act
according to events received.
> Can anyone provide some online references for doing this kind of thing?
The thumbnail generator of the espblog sample [1] works like that.
-Bertrand
[1] http://svn.apache.org/repos/asf/sling/trunk/samples/espblog/src/main/java/org/apache/sling/samples/espblog/internal/ThumbnailGeneratorServiceImpl.java