Forums / General / [Resolved]Disable access by URL to media on frontend

[Resolved]Disable access by URL to media on frontend

Author Message

Alain Sahli

Friday 01 May 2009 8:54:46 am

Hello,

I did a website with a lot of images and PDF files. This files are located in the media section. I gave access for content/read("standard", "media") to the anonymous members so they can read content and media files.

But my problem is that with this configuration each user can go to www.mysite.com/Media and the media Folder is shown.

Can I disable this ?

You can have a live demo here : http://www.smsa.ch/Media ;-)

Thanks for help !

http://www.wess.ch
eZ Publish Certified developer : http://auth.ez.no/certification/verify/272583

Marco Zinn

Saturday 02 May 2009 2:26:01 am

Bonjour Alain,

i know that issue. It's probably one of "those-who-must-not-be-talked-about" ;-)
I think, you cannot do this by read-rules, as these usually refer to the objects. As soon as you disallow read access to these objects, they will not be shown in the articles...

My suggestion: you should try to override the full-view-templates of the folder class, the image class and the file class IN the media section only (override condition: "section=media")

Marco
http://www.hyperroad-design.com

Ivo Lukac

Saturday 02 May 2009 3:00:36 am

Hi,

On the other hand you can always filter out Media urls with rewrite rules in .htaccess

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Gaetano Giunta

Sunday 03 May 2009 1:41:04 am

Besides marking as invisible the Media folder, which would not work as all its children would be hidden too, you can simply set it to a "reserved" section, that is not visible to anon user (ie. he has no content/read access to that section). You then switch back to the "media" section to all children of media, and you should be done

Principal Consultant International Business
Member of the Community Project Board

Alain Sahli

Thursday 07 May 2009 2:24:19 am

I did a rewrite rule in my .htaccess file. It works fine, thanks !

http://www.wess.ch
eZ Publish Certified developer : http://auth.ez.no/certification/verify/272583

eZ debug

Timing: Jan 18 2025 10:29:41
Script start
Timing: Jan 18 2025 10:29:41
Module start 'content'
Timing: Jan 18 2025 10:29:42
Module end 'content'
Timing: Jan 18 2025 10:29:42
Script end

Main resources:

Total runtime0.8798 sec
Peak memory usage4,096.0000 KB
Database Queries204

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.9688180.8203
Module start 'content' 0.00580.7453 769.7891656.2813
Module end 'content' 0.75120.1285 1,426.0703337.0625
Script end 0.8797  1,763.1328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00460.5205210.0002
Check MTime0.00150.1728210.0001
Mysql Total
Database connection0.00070.074010.0007
Mysqli_queries0.797190.60022040.0039
Looping result0.00240.27392020.0000
Template Total0.855997.320.4279
Template load0.00230.258020.0011
Template processing0.853697.024720.4268
Template load and register function0.00020.017210.0002
states
state_id_array0.00090.105010.0009
state_identifier_array0.00070.078920.0003
Override
Cache load0.00200.2233260.0001
Sytem overhead
Fetch class attribute can translate value0.00200.228550.0004
Fetch class attribute name0.00110.125090.0001
XML
Image XML parsing0.00240.273650.0005
class_abstraction
Instantiating content class attribute0.00000.0015100.0000
General
dbfile0.00680.7701460.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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs