kaltura / moodle_plugin

8 stars 37 forks source link

Access Kaltura video resource with guest access enabled #279

Open Kemmotar83 opened 4 years ago

Kemmotar83 commented 4 years ago

Hi,

when in a course the Guest access (enrollment method) is enabled, guests are able to open the Kaltura Video Resource page (view.php) but the Kaltura Player shows the message The user hasn't the required capability to use this service.

I've checked and this message is shown to users due to a control made in /mod/kalvidres/lti_launch.php (line 42-45). For me this code block should be removed, since it works against expected activities' behavior. If teachers want to enable guest access to resources, Kaltura should show media as well.

Removing those 4 lines everything works as desired.

Thanks, Giorgio

rlorenzo commented 4 years ago

What can also work is change this line to accept either guest or those with that capability.

https://github.com/kaltura/moodle_plugin/blob/MOODLE_37_DEV/mod/kalvidres/lti_launch.php#L42

if (!has_capability('mod/kalvidres:addinstance', $context) && !is_guest($context)) {

Kemmotar83 commented 4 years ago

I'm not sure about that. That check excludes from viewing any authenticated user without mod/kalvidres:addinstance capability (ie. student). Am i wrong?

Giorgio

rlorenzo commented 4 years ago

If you have guest access enabled shouldn’t is_guest() return true?

Kemmotar83 commented 4 years ago

Sure, but that if statement is done to deny access and the boolean expression _!has_capability('mod/kalvidres:addinstance', $context) && !isguest($context) will include any user without mod/kalvidres:addinstance capability (is. Student) and that is not a guest. Guest will be able to view the resource but users with Student role will not.

Maybe I am missing something, but for it's just better to remove the if block and let Moodle manage authorizations.

Giorgio

iancreid commented 3 years ago

We also need this problem solved. Has there been a resolution?

Kemmotar83 commented 3 years ago

We are still applying my patch and we are "happy" with that.

Giorgio