If the Media: Youtube module is installed, the Youtube tab comes up for all users who can access the media browser, even if they don't have the "Add media from remote services" permission from Media Internet Sources (which controls whether they can see the Web tab).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Rob C’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev
Status: Active » Needs review
FileSize
742 bytes

Something like this?

RobW’s picture

Title: Media: YouTube should respect Media Internet Sources permission, or create its own » YouTube tab should respect Media Internet Sources permission, or create its own
RobW’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

David_Rothstein’s picture

Status: Closed (fixed) » Active

The title of this issue suggests that the intention is to fully respect the Media Internet Sources permission, but that's not what the patch does. Instead, it's adding it on top of the existing media_access() check, which means that (unlike Media Internet itself) granting the "add media from remote sources" permission isn't enough to grant access to the YouTube tab too.

Also seems a little odd that the permission check is in the view() method, rather than access()...

I noticed this while configuring the module for a site - doesn't affect me too much because for now I have to give the users who will have access to this on that site the other permission anyway (for different reasons), but figured I'd mention it.

David_Rothstein’s picture

Status: Active » Needs review
FileSize
1.06 KB

Quick and completely untested patch :)

David_Rothstein’s picture

I guess it's worth pointing out that this patch isn't very backwards-compatible though (might change who has access to the tab when deployed on a live site).

RobW’s picture

Thanks, and nice work. The current dev is getting to be pretty non-backwards compatible, so one more drop won't hurt. If you can re-roll with an empty update hook with a comment about checking your media access permissions that would help. Although the patch looks good I'll leave it up until we get one more person to test and RTBC to avoid another early commit mistake.

David_Rothstein’s picture

Ah, there is a problem actually; I was using media_internet_access() but that function doesn't seem to be available in Media 1.x. So this patch replaces it with an inline permission check. (The "administer files" permission doesn't seem to be available in Media 1.x either, but "add media from remote sources" is so that should hopefully be good enough.)

I also added the update function. Not sure if the way I did it is what you're looking for (a completely empty function with a code comment that will appear in the update listing, vs. something like a drupal_set_message()).

Anyway, the patch is still 100% untested, so yes, it could use at least one person trying it out :)

David_Rothstein’s picture

Turned out I needed this for a site after all, but the site is running 7.x-2.0-rc1 so here is a patch that applies to that version.

The patch in #9 is still the one to review. However, at least this one will get a little manual testing. I'll report back if I run into any problems, but I don't expect any.

aaron’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.87 KB

I had to re-roll the patch, but it looks great from my end.

SocialNicheGuru’s picture

Issue summary: View changes

no longer applies (feb 6 dev)
patch -p1 < *1774266*
patching file includes/MediaYouTubeBrowser.inc
Hunk #1 FAILED at 14.
1 out of 1 hunk FAILED -- saving rejects to file includes/MediaYouTubeBrowser.inc.rej
patching file media_youtube.install
Hunk #1 succeeded at 156 with fuzz 2 (offset -10 lines).

SocialNicheGuru’s picture

Status: Reviewed & tested by the community » Needs work
Devin Carlson’s picture

Status: Needs work » Needs review
FileSize
1.5 KB

A reroll of #11 now that Media Internet 1.x includes a media_internet_access() function.

Devin Carlson’s picture

Status: Needs review » Fixed

Tested #14 with Media 1.x + 2.x and committed to Media: YouTube 7.x-2.x.

Status: Fixed » Closed (fixed)

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