aboutsummaryrefslogtreecommitdiff
path: root/lib/models
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
parenta44d881b5fe972fdb570a856078629a4d717f927 (diff)
added methods for a virtual global LTI toolstep-05405
Diffstat (limited to 'lib/models')
-rw-r--r--lib/models/LtiPlatform.php13
-rw-r--r--lib/models/LtiTool.php28
2 files changed, 41 insertions, 0 deletions
diff --git a/lib/models/LtiPlatform.php b/lib/models/LtiPlatform.php
index 6a76add..6fe431f 100644
--- a/lib/models/LtiPlatform.php
+++ b/lib/models/LtiPlatform.php
@@ -13,6 +13,8 @@
* @category Stud.IP
*/
+use OAT\Library\Lti1p3Core\Platform\Platform;
+
/**
* The LtiPlatform class represents LTI 1.3A platforms that are using
@@ -57,4 +59,15 @@ class LtiPlatform extends SimpleORMap
['platform_id' => $this->id]
);
}
+
+ public function getPlatformData() : Platform
+ {
+ return new Platform(
+ $this->id,
+ $this->name,
+ $this->url,
+ $this->oidc_init_url,
+ $this->oauth2_access_token_url
+ );
+ }
}
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;
+ }
}