Protecting content based on age

Author Message

Nathan Sharp

Wednesday 21 February 2007 5:34:42 pm

I have the desire to have a section of my eZp site protected based on age. Basically I'd like anonymous access for 30 days, or some configurable amount, then have the content automatically become available only for registered users. Is there any provisions for this, or can anyone think of any good ways for me to implement it?

Kristof Coomans

Wednesday 21 February 2007 11:19:43 pm

Hi Nathan

Concerning the timed anonymous access: this is quite difficult to accomplish, or even impossible. There's no way you can really make this work as far as I know (cookies can be removed, IP address can be the same for different users because a proxy is used).

The protection based on age should be a little bit easier. You can add an age selection box in the user account and then use the automated user placement extension to put the different ages in different user groups (to which different policies are assigned): http://ez.no/community/contribs/workflow/automated_user_placement_for_ez_publish_3_8

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Nathan Sharp

Thursday 22 February 2007 3:47:19 am

Thanks so much for the reply! When I said "age", I meant solely the age of the article, not of my users :-) So I guess I'll keep on looking.

Thanks!
Nathan

Kristof Coomans

Thursday 22 February 2007 4:13:29 am

Hi Nathan

So I was thinking too far :-)

Maybe you can write a custom cronjob that changes the section of an article (to a section the anonymous user has read access on) once it is old enough to be released to everyone?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

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 15:52:46
Script start
Timing: Jan 18 2025 15:52:46
Module start 'layout'
Timing: Jan 18 2025 15:52:46
Module start 'content'
Timing: Jan 18 2025 15:52:47
Module end 'content'
Timing: Jan 18 2025 15:52:47
Script end

Main resources:

Total runtime0.7086 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 587.9141152.6250
Module start 'layout' 0.00580.0036 740.539139.4609
Module start 'content' 0.00940.6976 780.0000544.9688
Module end 'content' 0.70690.0016 1,324.968812.1641
Script end 0.7086  1,337.1328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4798160.0002
Check MTime0.00150.2083160.0001
Mysql Total
Database connection0.00090.130510.0009
Mysqli_queries0.660393.1866600.0110
Looping result0.00050.0769580.0000
Template Total0.677695.620.3388
Template load0.00220.311320.0011
Template processing0.675495.315320.3377
Template load and register function0.00020.026410.0002
states
state_id_array0.00090.129610.0009
state_identifier_array0.00150.210920.0007
Override
Cache load0.00190.2623180.0001
Sytem overhead
Fetch class attribute can translate value0.00110.162020.0006
Fetch class attribute name0.00120.174350.0002
XML
Image XML parsing0.00050.076620.0003
class_abstraction
Instantiating content class attribute0.00000.001460.0000
General
dbfile0.00070.1019160.0000
String conversion0.00000.001540.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/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: 14
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs