Skip to content

Commit

Permalink
Merge pull request #983 from npocccties/fix-lti-resource-link
Browse files Browse the repository at this point in the history
fix: 最初にアクセスした教員または管理者をltiResourceLink.creatorとして紐付けられるように変更
  • Loading branch information
kou029w authored Jul 18, 2023
2 parents 891d411 + eb27217 commit d90f990
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/services/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
findLtiResourceLink,
upsertLtiResourceLink,
} from "$server/utils/ltiResourceLink";
import { isInstructor } from "$server/utils/ltiv1p3/roles";
import { getSystemSettings } from "$server/utils/systemSettings";
import getValidUrl from "$server/utils/getValidUrl";

Expand Down Expand Up @@ -35,14 +36,15 @@ async function init({ session }: FastifyRequest) {
ltiTargetLink.pathname === "/book" &&
ltiTargetLink.searchParams.get("bookId");
if (
isInstructor(session.ltiRoles) &&
session.ltiMessageType === "LtiResourceLinkRequest" &&
session.ltiResourceLinkRequest?.id &&
typeof bookId === "string" &&
Number.isInteger(Number(bookId))
) {
ltiResourceLink = {
bookId: Number(bookId),
creatorId: session.user.id,
creatorId: ltiResourceLink?.creatorId ?? session.user.id,
consumerId: session.oauthClient.id,
contextId: session.ltiContext.id,
id: session.ltiResourceLinkRequest.id,
Expand Down

0 comments on commit d90f990

Please sign in to comment.