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 <[email protected]> wrote: ----- To: [email protected] From: Ian Boston <[email protected]> Sent by: Ian Boston <[email protected]> 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 <[email protected]> wrote: ----- > > To: [email protected] > From: Bertrand Delacretaz <[email protected]> > 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 > <[email protected]> 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
