Comments

devin carlson’s picture

aaron’s picture

Maybe we should also allow users to switch files between any valid stream wrapper.

aaron’s picture

Assigned: Unassigned » aaron
Status: Active » Needs work
StatusFileSize
new2.63 KB

I am not certain that this is the right approach. This does not yet work properly, but it should give you an idea of where I'm headed with this.

aaron’s picture

Status: Needs work » Needs review
StatusFileSize
new4.8 KB

here you go

Status: Needs review » Needs work

The last submitted patch, move-files-scheme-1580820-4.patch, failed testing.

aaron’s picture

Status: Needs work » Needs review
StatusFileSize
new6.88 KB

This fixes the tests I believe.

Status: Needs review » Needs work

The last submitted patch, move-files-scheme-1580820-6.patch, failed testing.

aaron’s picture

Status: Needs work » Needs review
StatusFileSize
new11.16 KB
new15.63 KB

okay. I figured this out. with some screenshots to boot.

 add files

  destination

aaron’s picture

StatusFileSize
new4.99 KB

whoops

Status: Needs review » Needs work

The last submitted patch, move-files-scheme-1580820-9.patch, failed testing.

aaron’s picture

Status: Needs work » Needs review
StatusFileSize
new4.95 KB

and again, without the debugging statements.

Status: Needs review » Needs work

The last submitted patch, move-files-scheme-1580820-11.patch, failed testing.

aaron’s picture

Status: Needs work » Needs review

#11: move-files-scheme-1580820-11.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, move-files-scheme-1580820-11.patch, failed testing.

nicolas bouteille’s picture

Looks like this module is already doing this, or maybe could help you do what you want to do if not exactly the same.
http://drupal.org/project/file_entity_private_upload

treksler’s picture

It would be nice if non-developers didn't have to know or worry about a "public" or a "private" file system at all.

At the very least, the conversion should be automatic when needed. i.e. if the user wants to make the node private via content access, the attached files should be lazily converted to the managed (misnamed "private" in Drupal) filesystem. If they user wants to assign access controls to a file, they should be able to do that without worrying about file systems.

This is really basic UX stuff.

The more I think about it, files should always be managed. It is way simpler if all file urls are always /site/files/filename on all Drupal sites. The performance issues should be left up to varnish or whatever caching layer. ....but, that's a whole another story

devin carlson’s picture

Title: Add actions for privatizing and un-privatizing files » Provide an interface for selecting stream wrappers during file upload and converting files between stream wrappers
devin carlson’s picture

Title: Provide an interface for selecting stream wrappers during file upload and converting files between stream wrappers » Provide interfaces for selecting stream wrappers during file upload and converting files between stream wrappers

Finally got around to doing a review of #11 and it looks great!

I've got a few comments:

  • The scheme options are added to the filetype page, making it impossible to select a different scheme if the uploaded file's mimetype matches one of the configured file types (which results in the upload "wizard" skipping that step). I think it would be easiest/most user friendly to simply add a new "scheme" step to the wizard.
  • The scheme options don't take the file's filetype's allowed streams into account, so the user can end up selecting a disallowed scheme which, upon submitting the form, results in an error.

I'll try rolling an updated patch.

devin carlson’s picture

Status: Needs work » Needs review
StatusFileSize
new8.64 KB

A patch to address the feedback in #18.

devin carlson’s picture

Status: Needs review » Fixed

Committed #19 to 7.x-2.x.

dave reid’s picture

Status: Fixed » Needs work

Woah, really nice work with this issue. Do we have any kind of error handling if file_move() fails since it would assign $file to a boolean FALSE if there was a failure?

dave reid’s picture

Also, should the actual file_move() happen in the form, or in file_entity_file_presave() so that this could happen pragmatically?

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new857 bytes

I think something like this helps avoid the biggest issue if file_move() fails.

dave reid’s picture

Issue tags: +7.x-2.0 alpha blocker
StatusFileSize
new1.37 KB

Missed the second file_move() call with the file edit form.

Realizing we also need to limit access to this field if the file is read-only (cannot actually be moved), or a remote file.

Adding alpha blocker since we don't want to expose this when we shouldn't.

aaron’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me. Thanks for the catch.

dave reid’s picture

Status: Reviewed & tested by the community » Needs review

Missing restricted access to the destination fieldset, so not quite RTBC.

rob c’s picture

I just found this issue, wish i found it a month ago. I created this some time ago (see screenshot), so i think it's awesome this functionality is now added to this module, but i do wonder a bit. Does this patch also offers a way to limit the available filesystems on the file type settings page? (and what about permissions via a role based something?)

devin carlson’s picture

An updated patch to restrict access to the destination settings if the file is not writeable (the same check that is done when replacing files).

@Rob C, only the allowed streams for the file's file type are selectable.

@Dave Reid, I'm just curious (or likely missing something :P), why limit this to only local files? Wouldn't that limit valid use cases such as moving a file from one remote scheme to another; such as from Amazon S3 to Google Cloud Storage?

dave reid’s picture

If the S3 or Cloud Storage wrappers flag themselves as writable (since we're only looking for STREAM_WRAPPERS_WRITE_VISIBLE), then shouldn't they should be automatically visible here?

dave reid’s picture

Status: Needs review » Fixed

Committed #28 to 7.x-2.x, so I think this one can be resolved now.
http://drupalcode.org/project/file_entity.git/commit/4277d4d

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

johnpitcairn’s picture

Status: Closed (fixed) » Needs work

Errr ... may I strongly suggest that if admin has set the default storage in the file field settings, and the current user does not have explicit permission to override this, then the user should not be presented with this confusing and potentially dangerous screen.

There is no way I want my users deciding that file fields I have defined as private should be switched to public when they upload a file.

Could we perhaps have a permission to control this?

dave reid’s picture

Status: Needs work » Closed (fixed)

Please file a new issue with your proposed solution, rather than re-opening a fixed ticket.

mrfelton’s picture

Have to agree with #32 here. This has introduced a pretty serious UX issue and make uploading files only suitable for people that understand the difference between for example 'Public local files served by the webserver.' or 'Private local files served by Drupal.' - which really only encompasses Drupal developers - just a small fraction of this module's userbase.

Was a follow up issue created for this? I couldn't find one.

kkasischke’s picture

I strongly agree with #16 and #32 as well. Whenever a client's site is updated to include this change, I have editors and administrators submitting tons of support tickets and generally freaking out because they are confused by the new option when uploading, or someone tries putting a file in the wrong place.

I honestly can't think of a single client site we have built in the last five years where this option does anything except add confusion and more work. I also don't think this solved the original issue request, which seemed to be asking for a way to convert files from public to private after they had been already on the site.

Please, is there a way to simply limit this choice to certain roles?

Please don't dismiss this as just a rant. I need help finding the best way to remove this upload destination option for our clients. I guess I'll try to downgrade to the unstable version again, and hope that doesn't introduce any other problems. If there is another solution is a different issue, please point me to it, as I was not able to find it.

After making so many good strides towards more user-friendly Drupal, it seems a shame that this poor UX decision has been introduced.

devin carlson’s picture

StatusFileSize
new91.67 KB

@kkasischke it's a shame that you aren't using File entity's built in configuration options for disabling the "scheme" step of the file upload wizard. ;)

skip_scheme_selection.png

kkasischke’s picture

Thank you so much!

The real shame is that I can't buy you a beer. That, and the fact that no one has enough hours in the day to know every module as well as he would like to.

I'm glad there is a place to find experts who can help. Thanks again!

knalstaaf’s picture

Issue summary: View changes

In case someone would be looking for the settings page mentionned in #36, it's right over here: admin/config/media/file-settings.