Private folder for each user

Mindexperiment - August 21, 2009 - 08:33
Project:Web File Manager
Version:6.x-2.10-rc5
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi all,

I submit this issue as "feature request" but for now I have implement the code by my own.
I'm building a website that let the users have a private folder based on TOKEN [user]. The code I wrote goes well but is not an official release so I can't update the module every time a new version is released.

The workaround is simple, I added a new field on the administration page called "WebFM user directory:", this field provide some tokens to create a subfolder on the root every time a user complete the registration and has a certain role/permission.

Obviously the users don't have the "administer webfm" permission and they can navigate only on "/root/[user]" folder.

My website is for selling digital files so I can't let users view what other users have on it's own folder.. this is why I have wrote the patch for this module..
For now it seems to goes well on my test website but the code I wrote is too scratchy but would be a good idea to insert it on the official module if possible.

If you need the .php files don't esitate to contact me.
Thanks
Andy

#1

HansR - September 7, 2009 - 04:45

is there any news about this and if it will be implemented in a possible upgrade?

I would love to see this feature as it would simplify my administration BIG TIME and reduce the risk on admin mistakes. (linked to a online shop)

Mindexperiment: what about your php-files? Are they easy to install or does it require php knowledge?

#2

Mindexperiment - September 7, 2009 - 08:49

Hi HansR,

there's no news on this feature.. For now I'm changing all the file every tiime a new update is release.. I highlighted the part to change.. In the file attached you can find the row of the changes in the 3rd line... Every changes is between "////////////..".

You can simply override the file on your "/module/webfm" folder (without ".txt")..

It's not a good way to work but I can't learn all the webFM module only to make this feature so I'm waiting for someone who already know the module and can make this feature works better.

If you want to see a demo you have to wait a bit because I'm already building my website.. Or maybe you could become an alpha-tester :O)

Hope this help
Andy

AttachmentSize
webfm.admin_.inc_.txt 20.54 KB
webfm.module.txt 118.71 KB
webfm_file.inc_.txt 8.9 KB

#3

Mindexperiment - September 10, 2009 - 08:32

If you want you can simply integrate the users folder feature with ubercat.. You only have to change the function below on uc_file.module at about row 1182

/**
* Implement Drupal autocomplete textfield
*
* @return:
*   Sends string containing javascript array of matched files
*/
function _uc_file_autocomplete_filename() {

  global $user;

  $matches = array();

  // Catch "/" characters that drupal autocomplete doesn't escape
  $url = explode('_autocomplete_file/', request_uri());

  $string = $url[1];

  $files = db_query("SELECT filename FROM {uc_files} WHERE filename LIKE LOWER('%s')", '%'. strtolower($url[1]) .'%');

  if ( $user->uid == '1' ) {
while ($filename = db_result($files)) {
$matches[$filename] = $filename;
}
} else {
while ($filename = db_result($files)) {
$pos = strpos( $filename, $user->name );
if ( $pos !== FALSE ) {
$matches[$filename] = $filename;
}
}
  }
  asort($matches);

  print drupal_to_js($matches);
  exit();
}

This grant that users can add only their own feature (file download) when they create a new product. under "/node/NUM/edit/features/file/add".. The autocomplete field shown only the files under user's folder if user is not the admin..

Hope this help..
Andy

#4

HansR - September 15, 2009 - 01:39

will be trying it out soon.... and keep you updated how it went

thanks a lot

#5

HansR - September 15, 2009 - 01:40

thanks a lot Andy,

wouldn't mind being an alpha tester... everything for the greater good, huh ?

hahaha.... thanks a lot for the post... will try to code a bit further down, but will keep this as a back-up.

#6

breos - September 16, 2009 - 07:49

Hello Andy

I just intalled the web file manager and your modification and have a few questions about how it works.

In my web page, I will create the users manually, will disable the auto create account system.

How can I manage the creation of the user directory? Manually too? I have create a User and gave his role the access webfm permission and the directory didn't create automatically at hist first log.

What are the certain role/permission you mention in the description nedeed to create the directory?

...few hours later....
I have been working for a while with this modification...and I think it don't works or I dont understand what token means :-P

I think the function token_replace is missing or isn't working as it should :-/

...next day...
The function token_replace is missing. I have create the next function and seems to work

function token_replace($cadena, $token, $usuario) {
return str_replace ($token,$usuario->name,$cadena);
}

I'm not a programmer so I think this function isn't complete, I would like your token_replace function and the place where to copy it, please :-)

Thanks for the add-on to this awesome module

#7

cweagans - September 17, 2009 - 07:57

Hi

@breos: You need the Token module installed (token_replace is in token module)

@all, if you guys can roll a patch for this as per http://drupal.org/patch/create, I'd be happy to look it over, suggest/help with any improvements, and commit :)

#8

breos - September 17, 2009 - 08:58

Thanks cweagans, I will test it :-)

#9

Mindexperiment - September 18, 2009 - 12:47

Hi breos,

you have to install this module: http://drupal.org/project/token here you can find all the function you need.. I have try with only one user and the folder create automatically..

@cweagans I try to make a patch but is the first time I do that so be patience.. :O)

@HansR if you want to be an alpha tester you need to have at least 3 or more audio tracks composed/mastered by you.. The site wants to be a revolutionary place to sell/present audio products for artists, where artists decide all the feature of their products.. If you or other people have idea or suggestion can write to: info@digitallmusic.net

Smile
Andy

#10

Mindexperiment - September 19, 2009 - 12:26

I got the patch!!! YO!

AttachmentSize
webfm.admin_.patch 39.75 KB

#11

Mindexperiment - September 19, 2009 - 12:27
AttachmentSize
webfm.patch 4.68 KB

#12

Mindexperiment - September 19, 2009 - 12:27
AttachmentSize
webfm_file.patch 18.47 KB

#13

deekarma - September 27, 2009 - 00:57

Just what I was looking for, subscribing.

#14

Mindexperiment - September 28, 2009 - 10:01

Is there someone who's working on this??
Andy

#15

aiphes - November 18, 2009 - 14:07

hi

the only way is to add the patch to the module ? is this request will be implemanted in the future version of webfm ?
because it will be great to have possibility distingate users and role...i go to test it

thx

edit: i dont have the new field in admin/settings/webfm
where i can find him ?

 
 

Drupal is a registered trademark of Dries Buytaert.