aboutsummaryrefslogtreecommitdiff
path: root/lib/models/LtiTool.php
diff options
context:
space:
mode:
authorMoritz Strohm <strohm@data-quest.de>2025-04-10 12:46:32 +0200
committerMurtaza Sultani <sultani@data-quest.de>2025-09-11 16:20:06 +0200
commit52b151dbe997c3d91c60473611c3a1cf442f9659 (patch)
tree3c7f7ad923f639760e5a8fee32a07372c9b969e2 /lib/models/LtiTool.php
parenta44d881b5fe972fdb570a856078629a4d717f927 (diff)
added methods for a virtual global LTI toolstep-05405
Diffstat (limited to 'lib/models/LtiTool.php')
-rw-r--r--lib/models/LtiTool.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/models/LtiTool.php b/lib/models/LtiTool.php
index bde6203..e6dfddc 100644
--- a/lib/models/LtiTool.php
+++ b/lib/models/LtiTool.php
@@ -193,4 +193,32 @@ class LtiTool extends SimpleORMap
return _('unbekannt');
}
}
+
+ public static function getGlobalTool() : Tool
+ {
+ $c = Config::get();
+
+ return new Tool(
+ $c->STUDIP_INSTALLATION_ID,
+ $c->UNI_NAME_CLEAN,
+ $GLOBALS['ABSOLUTE_URI_STUDIP'],
+ URLHelper::getURL('dispatch.php/lti/auth/odic_init', null, true),
+ URLHelper::getURL('dispatch.php/lti/auth/oauth2_token', null, true)
+ );
+ }
+
+ public static function getGlobalJwksUrl() : string
+ {
+ return \URLHelper::getURL('dispatch.php/lti/auth/jwks');
+ }
+
+ public static function getGlobalToolKeyring(bool $generate = false) : ?\Keyring
+ {
+ $keyring = \Keyring::findOneBySQL("`range_type` = 'global' AND `range_id` = 'lti13a_tool'");
+ if ($generate && !$keyring) {
+ //Generate the keyring:
+ $keyring = \Keyring::generate('lti13a_tool', 'global');
+ }
+ return $keyring;
+ }
}