Forums / Setup & design / Showing links to protected areas

Showing links to protected areas

Author Message

Nathaniel Fitzgerald-Hood

Tuesday 17 February 2004 9:56:37 pm

Hi,

I have a main list of folders for a site which makes up the main menu. One requires authenticated access, so it doesn't show in the list unless a logged in user visits the site. How can I have the item show in the list even when an anonymous user visits resulting in it prompting for login?

Is there something I can supply to the fetch? If I hardcode the link it doubles up the link (1 is hardcoded, the other is from the fetch) when an authenitcated user visits the page. Or, do I need to test for a logged in user and not show the link twice manually?

Mark Marsiglio

Monday 13 June 2005 9:57:09 am

I am having this exact problem. Did anyone ever determine a solution? I need to show the links to content so that non-members get excited about the things they can't access, at which time they are redirected to a login/join page.

Seems like there should be a way to have the fetch ignore the permission/roles.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Xavier Dutoit

Tuesday 14 June 2005 12:14:09 am

A fetch that ignore the access right would be a big security problem. However, you can do that from an extension at the php level if you wish.

Anyway, the easiest solution (well, the one I use) is to test if the user is anonymous. If he's, then display the hardcoded link, otherwise, don't has it will be displayed from the regular fetch.

X+

http://www.sydesy.com

Mark Marsiglio

Wednesday 15 June 2005 1:53:08 pm

I ended up creating a solution for this, by modifying the pagelayout.tpl to show a message in place of the content if it is in the Members section.

The anonymous user has access to the member section, but the content display is limited by the template.


{* Determine if this page is in the Members section, and if not, show it normally *}
{section show=ne($module_result.section_id,6)}

   {$module_result.content}

{section-else}

{* If it is in the members section, determine if the user is logged as a member of the group which has access rights, and if so, show them the content normally *}
						
{let current_user=fetch('user','current_user') }
{section show=eq($current_user.contentobject.main_parent_node_id,157)}

                     {$module_result.content}

{section-else}

{* If the content is restricted, and the user is not logged in, display a message in place of the content *}

<h1>Sorry, this page is restricted</h1>

<p>The page you have requested is reserved for <b>FAIFA members only</b>. To take advantage of this and all of the other valuable benefits of members, please consider joining FAIFA. </p>

<p>If you are a current member, you may <a href="/user/login">log in here to access this page</a>. If you are a current member but do not have your user ID or password, please <a href="/contact_us/">contact us to request a user ID and password. </a></p>

{/section}

{/let}

{/section}

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

eZ debug

Timing: Jan 19 2025 00:29:49
Script start
Timing: Jan 19 2025 00:29:49
Module start 'content'
Timing: Jan 19 2025 00:29:50
Module end 'content'
Timing: Jan 19 2025 00:29:50
Script end

Main resources:

Total runtime0.9601 sec
Peak memory usage4,096.0000 KB
Database Queries199

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 588.8516180.8281
Module start 'content' 0.00660.8366 769.6797594.6484
Module end 'content' 0.84320.1167 1,364.3281337.3984
Script end 0.9600  1,701.7266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00470.4927210.0002
Check MTime0.00230.2394210.0001
Mysql Total
Database connection0.00070.072210.0007
Mysqli_queries0.890992.80031990.0045
Looping result0.00210.21381970.0000
Template Total0.925896.420.4629
Template load0.00240.250020.0012
Template processing0.923496.184720.4617
Template load and register function0.00020.023310.0002
states
state_id_array0.00080.079710.0008
state_identifier_array0.00070.069520.0003
Override
Cache load0.00210.2165200.0001
Sytem overhead
Fetch class attribute can translate value0.00110.112140.0003
Fetch class attribute name0.00120.119960.0002
XML
Image XML parsing0.00150.154440.0004
class_abstraction
Instantiating content class attribute0.00000.001470.0000
General
dbfile0.00240.2467320.0001
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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