eZ Community » Forums » Developer » What is the best solution to handle...
expandshrink

What is the best solution to handle licensed material?

What is the best solution to handle licensed material?

Tuesday 01 April 2003 10:23:44 am - 1 reply

If a purchased license is required to look at some documents, is this best handled with a workflow event? Can a workflow event be triggered for each document when making a document link list, so that only free documents and documents that the current user has purchased will be listed? Or how about listing the above mentioned links combined with links to information about available documents the customer has not purchased yet?

Can a workflow event be triggered in the shopping system after a purchase has been completed, so I can add the license information to the database?

I've just started looking at eZ, so the questions might be very basic or stupid happy.gif Emoticon

Tuesday 01 April 2003 5:03:57 pm

Workflows are designed to be used on one object at a time, this means only for the current object in a view and not on each item in a list.

What you can do here is the following:
1. Create a workflow event handler which detects the purchased product and stores in a database table that the user has the licence.
2. Create a template operator that takes a node ID as a parameter (or object ID if you wish), from the node ID you can figure out if the object requires licencing (by class ID or class group ID for instance). If so you check if the user has licence for it and return a special value, if not return another value. If the object is not for licencing return a third value.
Example of values:
0 - No licening, free for use
1 - Licenced, but no licence bought
2 - Licenced, and has licence

3. Add the operator to all your lists, where you check each item with the operator and displays one piece of template code if they have access or another if they don't.

I've done something similar a user could be subscribed to some sections, be able to buy in others and free use for specific classes.

The main problem here is cache, since cache is determined by the which roles you are related to two users with the same role will get the same content allthough one has bougth the licence and the other has not.
A solution to this (besides turning of caching) is to create a dummy role which a user is assigned to when the licence is bought.

Does this help?

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from