Currently the Media button, to either upload a new file or select an existing one, won't show unless the user has the "edit file" permission from the File Entity module. There needs to be a separation of permissions so that a user can be given permission to upload a new file or select an existing one without needing to edit all others, e.g. "upload new file", "select existing file", "upload from web".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

Title: "Media" button doesn't show unless user has "Edit all files" permission » "Media" button doesn't show unless user has "Edit file" permission
Dave Reid’s picture

Title: "Media" button doesn't show unless user has "Edit file" permission » The media field widget should be unrestricted and not require "Edit file" permission
Assigned: Unassigned » Dave Reid

Yeah I have a feeling that we shouldn't even restrict this field at all. It is not typical to restrict access to fields or field widgets unless using a module that actually implements hook_field_access() like http://drupal.org/project/field_permissions. We do actually have control over the individual tabs as-is. Editing files should be a separate button: #1213252: Allow media file's fields to be edited in a modal or after upload in the media widget.

Based on the above arguments, I'm going to recommend that we remove the check for 'edit files' in media_field_widget_form().

DamienMcKenna’s picture

My official response: \o/

Dave Reid’s picture

Status: Active » Needs review
FileSize
703 bytes
Dave Reid’s picture

Component: Miscellaneous » Code

This change should also be backported to 7.x-1.x.

Dave Reid’s picture

Status: Needs review » Fixed
oxford-dev’s picture

In comment #2, you state "We do actually have control over the individual tabs as-is". Could you explain how please?

I'm trying to setup a node type which only allows users to embed videos from external sites and don't want the file-browser or the file upload tabs to appear at all but cannot figure out what needs to be configured to achieve this.

Thanks

Dave Reid’s picture

Using Media 7.x-2.x, you can go to that field's configuration/edit page, and then select which media browser tabs should appear for that field.

oxford-dev’s picture

Just upgraded and now i see it.

Although i've just spotted another issue, maybe i need to submit another ticket for it?

After attaching a video from youtube, i then signed in as another user and tried to attach the same video but it fails with message "You have entered a URL for a video that is already in your library."

Because I don't want users to access the library this is a very real problem. Although adding the same file multiple times is not ideal, it should still not be prevented as multiple users may have a need to attach the same file. And as these are embedded videos' there is only the preview image being stored, not the actual video.

Dave Reid’s picture

For that just make sure to update to the latest Media: Youtube 7.x-1.x-dev - it fixes a bug that doesn't allow the same YouTube video to be re-used.

oxford-dev’s picture

But i've had to upgrade to 7.x-2 to be able to select which tabs I want visible.

Status: Fixed » Closed (fixed)

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

jenlampton’s picture

Status: Closed (fixed) » Active

I'm still having this problem using 7.x-2.x version. I need to grant users the "edit file" permission as well enable Upload as a browser plugin in order for my users to upload files. Is that the behavior that was intended?

Dave Reid’s picture

Status: Active » Fixed

That's kind of a separate issue. You need to have the 'edit file' permission in order to create files (and hence upload them). This permission logic should become way clearer after #1227706: Add a file entity access API which will then have a 'Add and upload files' permission. No one should have to 'enable' the Upload tab as by default all tabs should be permitted (pending any specific access per tab) unless you've customized which tabs should appear on a field, in which case that's kind of an administrator problem.

jenlampton’s picture

Ah, cool. Thanks! :)

Status: Fixed » Closed (fixed)

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

somatics’s picture

Status: Closed (fixed) » Needs work

I am still having this problem, even though I am using Media 7.x-1.0: Unless Edit media (Edit All Media Files) permissions is checked for the role, there is no upload button available to non-admin users.

This was supposed to be fixed by this version, right?

pverrier’s picture

I've exactly the same problem, also with 7.x-1.0.
I wish my users could upload files, but I don't want them to have the permission to modify any media of the website...

Dave Reid’s picture

Status: Needs work » Closed (fixed)

This is a separate issue which will be fixed with #1227706: Add a file entity access API. In order to use the 'Upload' tab you have to assign the 'Edit files/media' permission to the user role. This behavior will not be changing with 1.x at all.

pverrier’s picture

OK that's clear. I'll upgade to the next stable version of file entity.
Thanks for your answer.

elBradford’s picture

This worked, thank you.