-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fixes Opencast-Moodle/moodle-filter_opencast#54 #55
base: MOODLE_405_STABLE
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,11 @@ | |
|
||
namespace filter_opencast\local; | ||
|
||
use core\check\performance\debugging; | ||
use oauth_helper; | ||
use tool_opencast\local\settings_api; | ||
use tool_opencast\local\api; | ||
use moodle_exception; | ||
|
||
/** | ||
* LTI helper class for filter opencast. | ||
|
@@ -151,7 +154,8 @@ public static function is_lti_credentials_configured(int $ocinstanceid) { | |
*/ | ||
public static function get_lti_set_object(int $ocinstanceid) { | ||
$lticredentials = self::get_lti_credentials($ocinstanceid); | ||
$baseurl = settings_api::get_apiurl($ocinstanceid); | ||
// get url of the engage.ui | ||
$baseurl = self::get_engage_url($ocinstanceid); | ||
|
||
return (object) [ | ||
'ocinstanceid' => $ocinstanceid, | ||
|
@@ -188,4 +192,27 @@ public static function get_filter_lti_launch_url(int $ocinstanceid, int $coursei | |
} | ||
return $ltilaunchurl; | ||
} | ||
|
||
/** | ||
* Calls the URL of the presention node of opencast. | ||
* | ||
* This function calls an api endpoint because the url of the engage.ui is different depending on | ||
* the installation (All-In-One or Multiple Servers). | ||
* | ||
* @param int $ocinstancid | ||
* @return string $url the url of the engage.ui of the opencast installation | ||
* @throws \moodle_exception | ||
*/ | ||
public static function get_engage_url(int $ocinstancid) { | ||
$api = api::get_instance($ocinstancid); | ||
// Endpoint to call the engage.ui url of presentation node. | ||
// Make sure the api user has the rights to call that api endpoint. | ||
$engageurlendpoint = '/api/info/organization/properties/engageuiurl'; | ||
$result = json_decode($api->oc_get($engageurlendpoint), true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use opencastapi (Opencast PHP Library) property: getOrgEngageUIUrl
|
||
$url = $result['org.opencastproject.engage.ui.url']; | ||
if (!$url) { | ||
throw new \moodle_exception('no_engageurl_error', 'filter_opencast'); | ||
} | ||
return $url; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ | |
$string['setting_uselti_desc'] = 'When enabled, Opencast videos are delivered through LTI authentication using the <strong>default Opencast video player</strong>. This is typically used alongside Secure Static Files in Opencast for enhanced security.'; | ||
$string['setting_uselti_nolti_desc'] = 'To enable LTI Authentication for Opencast, you must configure the required credentials (Consumer Key and Consumer Secret) for this instance. Please do so via this link: {$a}'; | ||
$string['setting_uselti_ocinstance_name'] = 'Opencast API {$a} Instance'; | ||
$string['no_engageurl_error'] = 'No URL available. Please check if the api endpoint is available and if the api user has the proper rights.'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to use a more comprehensive (not-technical) info here, as it might be displayed to the end-users and they for example cannot check the api or the user rights! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this if it is not in use!