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


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

Something like this?

Title:Media: YouTube should respect Media Internet Sources permission, or create its ownYouTube tab should respect Media Internet Sources permission, or create its own

Status:Needs review» Fixed

Status:Fixed» Closed (fixed)

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

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.

Status:Active» Needs review
new1.06 KB

Quick and completely untested patch :)

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

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.

new1.91 KB

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

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.

Status:Needs review» Reviewed & tested by the community
new1.87 KB

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

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

Status:Reviewed & tested by the community» Needs work