Custom Permissions for download

zewa - April 28, 2009 - 10:47
Project:Filebrowser
Version:HEAD
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi ...

As stated some time ago with a issue, i have a NTFS checking builtin with the old version of Filebrowser.
Now today I tried the current version and it's quite different code than earlier.

I'd like to ask if it would be possible to do a little modification in the code.

At the position right before downloading happens, it would be nice if a seperate function, let's call it _custom_permission($filepath)
could be called which would return a bool value. If TRUE download should continue otherwhise stop and send a drupal_message.

Hope you could build in that one it would save me a ton of time, cause I'd have to go through the whole code
and for the devel this should be a thing of some minutes

Greetings
Zewa

#1

Yoran - May 18, 2009 - 21:45

The download process has no special right checking, it works like this :
- for the parent folder I get the file listing (the same I use for display).
- il the queried file is not in the list => 404
- else => download

I can isolate the code that check if a file is in ot out the list if this is what you need.

#2

zewa - May 19, 2009 - 06:00

ok well what I need to do is make some extra checkings if the file is NTFS protected.

Meaning following:

USER A is in following LDAP groups --> GROUP A, GROUP B

Downloadfolder structure:

MainFolder (No NTFS special rights)
|
|- Folder A (GROUP A Protected)
|- Folder B (GROUP B Protected)
|- Subfolder C (GROUP C Protected)

In this example USER A may only browse the first main folder and the Folder A/B.
If inside folder B he may not even see the Subfolder C in the directory Listing.

Also if the User enters the path to Subfolder C or a File inside it as a link, a checking must be done so he may not
see/download anything.

With the old version of Filebrowser I simply put around every listing, and filedownload:

if(_checkNTFS($thisFolder) == true)
{

}
else
{
   ECHO ERROR
}

And that would be exactly what I need that ifs on the right places, with a custom function
that for begin should always send back TRUE.
We could name it _customCheck() so it could be used for any kind of custom checking for Security Aspects.

Greetings
Zewa

 
 

Drupal is a registered trademark of Dries Buytaert.