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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

HansR’s picture

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?

Mindexperiment’s picture

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

Mindexperiment’s picture

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

HansR’s picture

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

thanks a lot

HansR’s picture

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.

breos’s picture

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

cweagans’s picture

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 :)

breos’s picture

Thanks cweagans, I will test it :-)

Mindexperiment’s picture

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

Mindexperiment’s picture

FileSize
39.75 KB
39.75 KB
18.47 KB
4.68 KB

I got the patch!!! YO!

Mindexperiment’s picture

FileSize
4.68 KB
Mindexperiment’s picture

FileSize
18.47 KB
deekarma’s picture

Just what I was looking for, subscribing.

Mindexperiment’s picture

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

aiphes’s picture

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 ?

robmilne’s picture

Status: Active » Postponed

I might be interested in adopting this idea if it was possible for me to see what you are changing. Your patches are not showing me exactly what you are touching in the code. I'm intending on releasing a 2.12 that contains bug fixes only so you will have to re-patch.

ermannob’s picture

Version: 6.x-2.10-rc5 » 6.x-2.11
FileSize
11.02 KB

I tried to play a bit with this and got a patch against 2.11 (not sure I got it right, that's my first!).
I'm attaching it here just for reference. So devs can evaluate it.
I'm going to try to generate a patch against 2.12.

ermannob’s picture

Version: 6.x-2.11 » 6.x-2.12
Status: Postponed » Active
FileSize
9.8 KB

I love patching! :-P
Here's a patch against 2.12.
I hope that's good. I tested it a little.

Reopening the issue, so more people can test this new feature.

Mindexperiment’s picture

It works for you? have you a live site where we can see the patch working?

=)

ermannob’s picture

I have no live sites using your patch yet. I'm evaluating it for a potential project.
Thanks for your efforts!

davidir81’s picture

great patch. thanks to post it!

We've been looking for a functionality like you patched, but when the user wants to see the files of his directory he can't see it. He has the permissions to view files with WebFilemanager. Any ideas?

Thanks for your work!
PD: If the user uploads a file, he can see it. But if you copy files with copy&pasto to the directory he can't see them. HE can see them if he has the permissions to manage.

davidir81’s picture

Hi guys,

We need to upload files by directories instead from the upload mothod. There's something that cron can insert to database this files? or something to change in the code to let to list the dir instead of the database records?

Thanks a lot!

David

cgmonroe’s picture

FYI - This is a separate issue from the one it's posted under.

By "Upload directories", I think you mean that a user specifies the directory name and all files in it get uploaded. This is impossible to do with JavaScript and standard HTML because it would violate the standard security model. E.g., in order to get the list of files to "attach", JS would have to be able to read the local hard drive info. If this was allowed, hackers could have web pages that secretly got a lot of information about people they shouldn't have.

Plus, the way that HTML uploads files is very inefficient. If there were a lot of files in that directory, it could either bog down the server (CPU and memory usage) while the upload is being processed or cause end user problems when the upload process timed out due to too much time used on the page.

If you need to bulk upload files, it's better to use standard file transfer programs like FTP or SCP that are designed to do this.

Once the files are in the WebFM directory on the server, you will need to add them to the "database". (WebFM Admin option). I don't think there is a current cron option to add these. But it might not be too hard to add the "insert" case code from the webfm_ajax function to a cron function.

davidir81’s picture

Hi my friend,

the webFM has a new release in dev, that it's interesting to insert files to db with cron. Do you have planned to do a patch wit it?

Thanks,

David

RdeBoer’s picture

Something similar is now available as a patch to 6.x-2-12. See #863346: User-private upload directories

nallasivamkn’s picture

Hi all,

I am very new to Webfm. I want add two more columns in webfm front end display... currently it is displaying Name, Modified, Size and Owner of the file, but i want to add two more columns. One is for displaying the file created date and another one is for user, who last modified that file....

Can anyone help me....

Thanks in advance....

tazus’s picture

subscribe

loziofabio’s picture

Category: feature » support

Hi everybody,

I'm testing this patch on Drupal 6.9 with WebFM 6.x-2.11 and Token 6.x-1.16....

Everything seems fine with directory configuration and user creation, I just can't restrict users to access their own directory only: any user gets access to any directory.

In WebFM administration I set a role-based directory called "Public" containing all user-based sub-directories, named after each user (Public/[user])....

When a new user logs in for the first time the new directory is correctly created, but he/she has view/download access to any other sub-directory under Public folder...

Anybody has a clue on how to fix this?
Thanx

nhck’s picture

Category: support » feature