sensei icon indicating copy to clipboard operation
sensei copied to clipboard

VideoPress uploads as teacher fail

Open jom opened this issue 7 years ago • 3 comments

See https://github.com/Automattic/sensei/issues/2128#issuecomment-1283109987 for latest update.

Steps to Reproduce

  1. Activate and connect Jetpack with a Professional plan; activate the video storage feature.
  2. Log in as a teacher.
  3. Try to upload a video while editing a lesson.
  4. Video won't upload correctly and the user will immediately lose access if they view the media library.

What I Expected

Ability to insert videos uploaded via VideoPress into courses/lessons as a teacher.

What Happened Instead

Immediately lose access.

WordPress / Sensei version

Sensei 1.10.1 WP 4.9.5

Browser / OS version

Chrome

=======

VideoPress uploads videos and sets the attachment author to ID of 0. We are currently filtering all attachments to just those created by the teacher. One possible fix is in https://github.com/Automattic/sensei/commit/0d9139394e50f0fc4a0774c6ea7f10b5eacc39fc, however there still seems to be some choppiness (need to refresh before inserting uploaded media).

jom avatar Apr 23 '18 14:04 jom

May not need to do anything here as it could be fixed by VideoPress. For reference - pxWta-N4-p2.

donnapep avatar Apr 26 '18 18:04 donnapep

Hi, Is there any change in this issue?

Meanwhile, I tested it further:

A user with "Author" or "Contributor" role can see all uploaded videos, no matter who uploaded it. This is also a mistake. It would be better if all users would only see the video which they uploaded own.

"Teacher" role (with Sensei plugin) works well, because teachers can only see their own media (music, pdf, image) except the video. Unfortunately, they still can not see it.

I am waiting for your reply!

BR, Roland

amroland avatar May 28 '18 13:05 amroland

I tested this out today and found out that:

  • The uploads now do work for VideoPress
  • There is still a permission problem where the teacher can't view the uploaded VideoPress videos

I think it has to do with restrict_media_library_modal here https://github.com/Automattic/sensei/blob/132dda1146fa7ba7e5508886ccda5e97b7c368e0/includes/class-sensei-teacher.php#L1451

When a VideoPress video is uploaded, the author get's set to the Jetpack site owner ID, not the teacher id.

Maybe a good workaround would be:

  1. Hook into the videopress upload
  2. If it's a post_mime_type of video/videopress, add postmeta to set the teacher ID
  3. Add a check to restrict_media_library_modal to check for that postmeta

mikeyarce avatar Oct 18 '22 23:10 mikeyarce