[daisy] problem adding a document subscription for a newly created user

Bruno Dumon bruno at outerthought.org
Fri Nov 10 07:44:51 CST 2006


On Fri, 2006-11-10 at 12:16 +0100, Andreas Deininger wrote:
> Hi,
> 
> I wrote a custom Cocoon apple which at its end creates a new daisy
> user. Everything works fine so far. Now I would like to add a document
> subscription for that newly created user, and I ran into trouble doing
> so. My code looks like:
> 
> EmailSubscriptionManager subscriptionManager =
> (EmailSubscriptionManager)adminrepository.getExtension("EmailSubscriptionManager");
> subscriptionManager.addDocumentSubscription(user.getId(), new
> VariantKey("3910-MBA",3,2));
> Subscription newusersubscription =
> subscriptionManager.getSubscription(user.getId());
> newusersubscription.setReceiveDocumentEvents(true);
> newusersubscription.save();
> 
> This code actually sets the "receive documents" flag for the newly
> created user, however, it does not add the document subscription, and
> I couldn't figure out the reason for the latter.

I think you've found a bug. If you look at line  394 of
LocalEmailSubscriptionManager, you 'll see:

Subscription subscription = getSubscription();

but the getSubscription method should have the userId as argument,
otherwise it will take the one from the current user (adminrepository).

Subscription subscription = getSubscription(userId);

I'll commit the fix shortly.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno at outerthought.org                          bruno at apache.org



More information about the daisy mailing list