Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override LTI launch parameters #367

Open
estevebadia opened this issue Jun 13, 2022 · 1 comment
Open

Override LTI launch parameters #367

estevebadia opened this issue Jun 13, 2022 · 1 comment

Comments

@estevebadia
Copy link

It would be very useful for us to be able to override the LTI parameters this plugin is sending to Kaltura in a similar way the core LTI activity plugin allows parameter overrides.

Kaltura plugin sends the Moodle username as the LTI user_id parameter. In our setting, users access Kaltura media either through Moodle and through a different platform. From our second platform we can't know Moodle usernames so we'd like to change the user_id that Moodle is sending to Kaltura via LTI so they both match.

The core LTI activity module provides the before_launch callback that allow subplugins -called ltisource plugins- to override LTI params (example of ltisource plugins). We could call the same before_launch or a custom before_kaltura_launch callback from this kaltura plugin to give other plugins the opportunity to override LTI parameters as in the core LTI module.

We're willing to develop this feature and provide a PR if you are open to accept this feature. Thank you!

@estevebadia
Copy link
Author

Just in case this is of interest to Kaltura plugin maintainers or anyone else, we've implemented this feature by adding the following lines to the file local/kaltura/locallib.php in function local_kaltura_request_lti_launch before the call to lti_sign_parameters.

    // Call plugins of type ltisource providing the before_launch hook
    // implementation the same way it is done by Moodle's LTI mod.
    $callbacks = get_plugin_list_with_function('ltisource', 'before_launch');
    foreach ($callbacks as $plugin => $function) {
        $pluginparams = component_callback($plugin, 'before_launch', [$lti, $endpoint, $requestparams], []);
        if (!empty($pluginparams) && is_array($pluginparams)) {
            $requestparams = array_merge($requestparams, $pluginparams);
        }
    }

I'll be happy to provide a PR to your branches if you're willing to accept this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant