Automattic / sensei

Sensei LMS - Online Courses, Quizzes, & Learning
https://senseilms.com
GNU General Public License v2.0
539 stars 198 forks source link

Teacher role can not see his own lessons if not assigned to a Course. #5495

Open aaronfc opened 2 years ago

aaronfc commented 2 years ago

Steps to Reproduce

  1. Login with a user with Teacher role.
  2. Create a Lesson (not assigned to any course).
  3. Add some contents to the Lesson.
  4. Publish the lesson and go to the lesson through the permalink.

What I Expected

To see the Lesson content.

What Happened Instead

The Lesson appears with empty content.

PHP / WordPress / Sensei LMS version

Sensei LMS: 4.6.2

Context / Source

This issue was originally detected during the Interactive Video block project here.

Basically the permission check here is returning false since there is no course when checking for permissions in here and here.

Originally posted by @aaronfc in 1727-gh-Automattic/sensei-pro#issuecomment-1220833499

aaronfc commented 2 years ago

The fix might need some special care since there might be some corner cases like this one: https://github.com/Automattic/sensei/issues/3814