anonymous user can see attachment link, but not download without authentication

Bacteria Man - January 13, 2009 - 08:30
Project:Private Upload
Version:5.x-1.0-rc2
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

This idea was inspired by my post in the Post Installation forum.

I'd like to allow anonymous users to see private node attachment links, but when clicking on a link they will be redirected to the login page (which would include appropriate context messaging.) The idea is to entice users to become members and gain access to valuable resources.

I'm wondering if this feature is appropriate for Upload Permissions Per Content Type. It seems like a reasonable addition, but perhaps it's beyond the scope and intended purpose of the module.

Thoughts?

#1

Bacteria Man - January 17, 2009 - 03:27

On second thought, I'm thinking the Private Upload module is a closer match for my needs.

#2

Bacteria Man - January 17, 2009 - 03:28
Status:active» closed

I'm closing this for the reason above.

#3

Bacteria Man - January 17, 2009 - 05:56
Project:Upload Permissions Per Content Type» Private Upload
Version:5.x-1.x-dev» 5.x-1.0-rc2
Status:closed» active

I'm switching this feature request from Upload Permissions Per Content Type to Private Upload.

How involved would it be to implement the original post in this thread?

#4

Bacteria Man - January 17, 2009 - 06:01

To clarify my idea, the node is accessible by anonymous users but to download the private file requires authentication. The attachment link is exposed, but when the user clicks on the link they are redirected to the login page (or perhaps a page node explaining why they must login or register to access the file.)

#5

Bacteria Man - January 17, 2009 - 06:02
Title:anonymous user can look, but don't touch attachments» anonymous user can see attachment link, but not download without authentication

Changing to more descriptive title.

#6

simplyrahul - July 3, 2009 - 05:56

I was looking for the same thing

If using CCK - goto file_formatter.inc in filefield folder in module

and paste the following code at the bottom

global $user;
if ($user->uid == 0) {
$url = "";
$link_text = "You must register or login to download attachments.";
}

  return '<div class="filefield-file clear-block">'. $icon . l($link_text, $url, $options) .'</div>';
}

I do not know how safe it it. But it worked for me. And it seems to be fine.

#7

g99k - July 19, 2009 - 10:27

There is a Restricted Content module that still displays links to restricted nodes, but has anonymous users be directed to a custom page which tells them to login. If you can move your downloads to a separate node, that should be the right module for you.

#8

Bacteria Man - July 19, 2009 - 18:14

Yeah, I like the approach the Restricted content module. However my original requirement was to restrict access to files that are NOT nodes or attachments of nodes.

I'm actually working on a small module that does just that and hope to release it within a couple of weeks (family and work commitments permitting.) The first version will provide "all or nothing" access tied to a single permission, but I can envision doing something more granular in future versions.

#9

jmather - August 3, 2009 - 20:01

Following

 
 

Drupal is a registered trademark of Dries Buytaert.