Tsugi

ToolRegistrationService
in package

Outbound LTI tool registration inside one tenant key.

key_id is the tenant boundary. owner_org_id and owner_context_id say who administers the registration. They do not say where a deployment may be used. Both null means the tenant administers it. One of them may be set. The registration itself does not make the tool visible. Deployments do that.

A registration is LTI 1.3 unless lti_version is 1.1. An LTI 1.1 registration stores lti11_key, lti11_secret, and lti11_url, leaves every lti13_ column null, and gets exactly one deployment whose external deployment_id is null. Its message rows are synthesized from $meta['messages'] and $meta['placements']. Name, email, grade, and roster checkboxes are stored as $meta['claims'] and $meta['scopes'] on the same registration document an LTI 1.3 registration uses. An LTI 1.3 registration stores lti13_ columns and leaves the lti11_ columns null. lti13_client_id is optional. Its messages arrive later in the registration document.

Table of Contents

Methods

courseLti11()  : array{registration_id: int, key_id: int, owner_context_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string}
The stored LTI 1.1 fields for a tool this course owns.
createLti11ForCourse()  : int
Add an LTI 1.1 tool to one course.
createLti13ForCourse()  : array{registration_id: int, tool_deployment_id: int}
Add an LTI 1.3 tool to one course from a Dynamic Registration document.
createRegistration()  : int
deleteLti11ForCourse()  : void
Delete an LTI 1.1 tool this course owns.
deleteLti13ForCourse()  : void
Delete an LTI 1.3 tool this course owns.
findRegistration()  : array<string, mixed>|null
mayAdminister()  : bool
Whether this actor may edit the registration.
otherLaunchUrlCount()  : int
How many other LTI 1.1 registrations in this course's tenant store this launch URL.
otherLaunchUrlCounts()  : array<int, int>
Other LTI 1.1 tools in the same tenant that store each registration's launch URL.
updateLti11ForCourse()  : void
Replace an LTI 1.1 tool this course owns.
visibleLti11()  : array{registration_id: int, key_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string}
An LTI 1.1 registration this course can launch.
visibleLti11Deployment()  : array{registration_id: int, key_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string, tool_deployment_id: int}
An LTI 1.1 deployment this course can launch.
visibleLti13()  : array{registration_id: int, owner_context_id: ?int, title: string, client_id: string, oidc_login_url: string, jwks_url: string, launch_url: string, redirect_uris: array, custom_parameters: array, messages: array, custom_parameters: array}>, requested_claims: array, requested_scopes: array, deployments: array, allowed_scopes: array, enabled_placements: array}>, registration_json: string, registration_logs: array>}
An LTI 1.3 registration this course can see, with the stored document.
allowRequestedGrants()  : void
Allow each claim and scope the registration asks for that is not already allowed.
creatorOnKey()  : int|null
Record the signed-in user when they belong to this course's tenant.
db()  : PDOX
deleteOwnedCourseRegistration()  : void
enableAvailablePlacements()  : void
findContext()  : array<string, mixed>|null
findOrg()  : array<string, mixed>|null
lti11LaunchFields()  : array{registration_id: int, key_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string}
metaFields()  : array<string, mixed>
optionalContextId()  : int|null
optionalOrgId()  : int|null
optionalUserId()  : mixed
prefix()  : string
requireId()  : int
requireKey()  : void
requireOneProtocol()  : array<string, mixed>
requireOrg()  : array<string, mixed>
requireOwnedCourseLti11()  : array{registration_id: int, key_id: int, owner_context_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string, context_id: int}
splitCheckboxMeta()  : array{fields: array, messageTypes: array, placements: array, claims: array, scopes: array}

Methods

courseLti11()

The stored LTI 1.1 fields for a tool this course owns.

public static courseLti11(int $contextId, int $registrationId) : array{registration_id: int, key_id: int, owner_context_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string}
Parameters
$contextId : int
$registrationId : int
Return values
array{registration_id: int, key_id: int, owner_context_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string}

createLti11ForCourse()

Add an LTI 1.1 tool to one course.

public static createLti11ForCourse(int $contextId, string $title, int|null $createdByUserId, array<string, mixed> $meta) : int

The registration is owned by that course. Its one deployment is assigned to that course and to no organization. Checked placements are enabled on the deployment. Checked claims and scopes are both requested and allowed.

Parameters
$contextId : int
$title : string
$createdByUserId : int|null
$meta : array<string, mixed>
Return values
int —

registration_id

createLti13ForCourse()

Add an LTI 1.3 tool to one course from a Dynamic Registration document.

public static createLti13ForCourse(int $contextId, int|null $createdByUserId, string $title, array<string, mixed> $meta, array<string, mixed> $document, string $deploymentId) : array{registration_id: int, tool_deployment_id: int}

The registration is owned by that course. One deployment is created, assigned to that course, and granted the placements, claims, and scopes the document asks for.

Parameters
$contextId : int
$createdByUserId : int|null
$title : string
$meta : array<string, mixed>

lti13 client id, login URL, keyset, launch URL, redirect URI

$document : array<string, mixed>

parsed registration, including client_id and deployment_id

$deploymentId : string

external LTI deployment_id

Return values
array{registration_id: int, tool_deployment_id: int}

createRegistration()

public static createRegistration(int $keyId, string $title[, int|null $ownerOrgId = null ][, int|null $createdByUserId = null ][, array<string, mixed> $meta = array() ][, int|null $ownerContextId = null ]) : int
Parameters
$keyId : int

tenant key

$title : string
$ownerOrgId : int|null = null

null with a null course means the tenant administers it

$createdByUserId : int|null = null
$meta : array<string, mixed> = array()

lti_version, lti11_key, lti11_secret, lti11_url, messages, placements, claims, scopes, lti13_client_id, lti13_oidc_login_url, lti13_jwks_url, lti13_launch_url, lti13_redirect_uri, json

$ownerContextId : int|null = null

course administrator; mutually exclusive with $ownerOrgId

Return values
int —

registration_id

deleteLti11ForCourse()

Delete an LTI 1.1 tool this course owns.

public static deleteLti11ForCourse(int $contextId, int $registrationId) : void

Deployments, messages, placements, and grants go with the registration.

Parameters
$contextId : int
$registrationId : int

deleteLti13ForCourse()

Delete an LTI 1.3 tool this course owns.

public static deleteLti13ForCourse(int $contextId, int $registrationId) : void

Deployments, messages, placements, and grants go with the registration.

Parameters
$contextId : int
$registrationId : int

findRegistration()

public static findRegistration(int $registrationId) : array<string, mixed>|null
Parameters
$registrationId : int
Return values
array<string, mixed>|null

mayAdminister()

Whether this actor may edit the registration.

public static mayAdminister(int $registrationId, array{system?: bool, key_id?: int, org_id?: int, context_id?: int} $actor) : bool

This is not a new permissions table. The actor is a scope Tsugi already has: the system administrator, one tenant key, one organization, or one course. A system administrator may manage every registration. A tenant administrator may manage every registration on that key, including org-owned and course-owned ones. An organization administrator may manage a registration owned by that organization or an organization below it. A course administrator may manage a registration owned by that course.

Parameters
$registrationId : int
$actor : array{system?: bool, key_id?: int, org_id?: int, context_id?: int}
Return values
bool

otherLaunchUrlCount()

How many other LTI 1.1 registrations in this course's tenant store this launch URL.

public static otherLaunchUrlCount(int $contextId, string $url[, int $exceptRegistrationId = 0 ]) : int

The URL is not an identifier. This count is only a note.

Parameters
$contextId : int
$url : string
$exceptRegistrationId : int = 0

the tool being edited, so it is not counted as another tool

Return values
int

otherLaunchUrlCounts()

Other LTI 1.1 tools in the same tenant that store each registration's launch URL.

public static otherLaunchUrlCounts(array<int, int> $registrationIds) : array<int, int>
Parameters
$registrationIds : array<int, int>
Return values
array<int, int> —

registration_id => count of other tools

updateLti11ForCourse()

Replace an LTI 1.1 tool this course owns.

public static updateLti11ForCourse(int $contextId, int $registrationId, string $title, array<string, mixed> $meta) : void

The course assignment stays. Message rows are rebuilt, so placement enablement is written again and grants follow the new request.

Parameters
$contextId : int
$registrationId : int
$title : string
$meta : array<string, mixed>

visibleLti11()

An LTI 1.1 registration this course can launch.

public static visibleLti11(int $contextId, int $registrationId) : array{registration_id: int, key_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string}

The course does not have to own it. A tool shared into the course is included.

Parameters
$contextId : int
$registrationId : int
Return values
array{registration_id: int, key_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string}

visibleLti11Deployment()

An LTI 1.1 deployment this course can launch.

public static visibleLti11Deployment(int $contextId, int $toolDeploymentId) : array{registration_id: int, key_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string, tool_deployment_id: int}

A lesson item stores tool_deployment_id. The deployment is in scope for the course. Claims and scopes are that deployment's grants.

Parameters
$contextId : int
$toolDeploymentId : int
Return values
array{registration_id: int, key_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string, tool_deployment_id: int}

visibleLti13()

An LTI 1.3 registration this course can see, with the stored document.

public static visibleLti13(int $contextId, int $registrationId) : array{registration_id: int, owner_context_id: ?int, title: string, client_id: string, oidc_login_url: string, jwks_url: string, launch_url: string, redirect_uris: array, custom_parameters: array, messages: array, custom_parameters: array}>, requested_claims: array, requested_scopes: array, deployments: array, allowed_scopes: array, enabled_placements: array}>, registration_json: string, registration_logs: array>}

The course does not have to own it. A tool shared into the course is included.

Parameters
$contextId : int
$registrationId : int
Return values
array{registration_id: int, owner_context_id: ?int, title: string, client_id: string, oidc_login_url: string, jwks_url: string, launch_url: string, redirect_uris: array, custom_parameters: array, messages: array, custom_parameters: array}>, requested_claims: array, requested_scopes: array, deployments: array, allowed_scopes: array, enabled_placements: array}>, registration_json: string, registration_logs: array>}

allowRequestedGrants()

Allow each claim and scope the registration asks for that is not already allowed.

private static allowRequestedGrants(int $registrationId, int $deploymentId) : void
Parameters
$registrationId : int
$deploymentId : int

creatorOnKey()

Record the signed-in user when they belong to this course's tenant.

private static creatorOnKey(mixed $userId, int $keyId) : int|null

A site login on another key still adds the tool; created_by stays empty.

Parameters
$userId : mixed
$keyId : int
Return values
int|null

deleteOwnedCourseRegistration()

private static deleteOwnedCourseRegistration(int $contextId, int $registrationId, string $version) : void
Parameters
$contextId : int
$registrationId : int
$version : string

1.1 or 1.3

enableAvailablePlacements()

private static enableAvailablePlacements(int $deploymentId) : void
Parameters
$deploymentId : int

findContext()

private static findContext(int $contextId) : array<string, mixed>|null
Parameters
$contextId : int
Return values
array<string, mixed>|null

findOrg()

private static findOrg(int $orgId) : array<string, mixed>|null
Parameters
$orgId : int
Return values
array<string, mixed>|null

lti11LaunchFields()

private static lti11LaunchFields(int $registrationId) : array{registration_id: int, key_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string}
Parameters
$registrationId : int
Return values
array{registration_id: int, key_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string}

metaFields()

private static metaFields(array<string, mixed> $meta) : array<string, mixed>
Parameters
$meta : array<string, mixed>
Return values
array<string, mixed>

optionalContextId()

private static optionalContextId(mixed $contextId) : int|null
Parameters
$contextId : mixed
Return values
int|null

optionalOrgId()

private static optionalOrgId(mixed $orgId) : int|null
Parameters
$orgId : mixed
Return values
int|null

optionalUserId()

private static optionalUserId(mixed $userId, mixed $keyId) : mixed
Parameters
$userId : mixed
$keyId : mixed

requireId()

private static requireId(mixed $id, string $label) : int
Parameters
$id : mixed
$label : string
Return values
int

requireOneProtocol()

private static requireOneProtocol(array<string, mixed> $fields) : array<string, mixed>
Parameters
$fields : array<string, mixed>
Return values
array<string, mixed>

requireOrg()

private static requireOrg(int $orgId) : array<string, mixed>
Parameters
$orgId : int
Return values
array<string, mixed>

requireOwnedCourseLti11()

private static requireOwnedCourseLti11(int $contextId, int $registrationId) : array{registration_id: int, key_id: int, owner_context_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string, context_id: int}
Parameters
$contextId : int
$registrationId : int
Return values
array{registration_id: int, key_id: int, owner_context_id: int, title: string, lti11_key: string, lti11_secret: string, lti11_url: string, context_id: int}

splitCheckboxMeta()

private static splitCheckboxMeta(array<string, mixed> $meta) : array{fields: array, messageTypes: array, placements: array, claims: array, scopes: array}
Parameters
$meta : array<string, mixed>
Return values
array{fields: array, messageTypes: array, placements: array, claims: array, scopes: array}

        
On this page

Search results