What is the best solution to handle licensed material?

Author Message

Tore Jørgensen

Tuesday 01 April 2003 12:23:44 am

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

Jan Borsodi

Tuesday 01 April 2003 7:03:57 am

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?

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 10:32:19
Script start
Timing: Jan 18 2025 10:32:19
Module start 'layout'
Timing: Jan 18 2025 10:32:19
Module start 'content'
Timing: Jan 18 2025 10:32:21
Module end 'content'
Timing: Jan 18 2025 10:32:21
Script end

Main resources:

Total runtime1.8046 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0093 588.1484152.6406
Module start 'layout' 0.00930.0036 740.789139.4766
Module start 'content' 0.01291.7900 780.2656524.2656
Module end 'content' 1.80290.0017 1,304.531312.1250
Script end 1.8046  1,316.6563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.2178160.0002
Check MTime0.00140.0763160.0001
Mysql Total
Database connection0.00170.095410.0017
Mysqli_queries1.747796.8454540.0324
Looping result0.00070.0382520.0000
Template Total1.764797.820.8824
Template load0.00290.162420.0015
Template processing1.761897.626320.8809
Template load and register function0.00020.013610.0002
states
state_id_array0.00070.040510.0007
state_identifier_array0.00260.145620.0013
Override
Cache load0.00230.1282210.0001
Sytem overhead
Fetch class attribute can translate value0.00090.050920.0005
Fetch class attribute name0.00180.101730.0006
XML
Image XML parsing0.00090.052420.0005
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00090.0487170.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 11
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs