Plugin: LTI: Fix lineitem.readonly scope in AGS

pull/4364/head
Angel Fernando Quiroz Campos 3 years ago
parent e695cb1118
commit 7a6266b72c
  1. 16
      plugin/ims_lti/auth.php
  2. 8
      plugin/ims_lti/src/Service/Resource/LtiLineItemResource.php
  3. 4
      plugin/ims_lti/src/Service/Resource/LtiLineItemsResource.php

@ -207,15 +207,21 @@ try {
if (LtiAssignmentGradesService::AGS_NONE !== $advServices['ags']) {
$agsClaim = [
'scope' => [
LtiAssignmentGradesService::SCOPE_LINE_ITEM,
LtiAssignmentGradesService::SCOPE_LINE_ITEM_READ,
LtiAssignmentGradesService::SCOPE_RESULT_READ,
LtiAssignmentGradesService::SCOPE_SCORE_WRITE,
],
'lineitems' => LtiAssignmentGradesService::getLineItemsUrl(
$course->getId(),
$tool->getId()
),
];
if (LtiAssignmentGradesService::AGS_FULL === $advServices['ags']) {
$agsClaim['scope'][] = LtiAssignmentGradesService::SCOPE_LINE_ITEM;
}
$agsClaim['lineitems'] = LtiAssignmentGradesService::getLineItemsUrl(
$course->getId(),
$tool->getId()
);
if ($tool->getLineItems()->count() === 1) {
$agsClaim['lineitem'] = LtiAssignmentGradesService::getLineItemUrl(
$course->getId(),

@ -56,12 +56,20 @@ class LtiLineItemResource extends LtiAdvantageServiceResource
$this->processGet();
break;
case Request::METHOD_PUT:
if (LtiAssignmentGradesService::AGS_FULL !== $this->tool->getAdvantageServices()['ags']) {
throw new MethodNotAllowedHttpException([Request::METHOD_GET]);
}
$this->validateToken(
[LtiAssignmentGradesService::SCOPE_LINE_ITEM]
);
$this->processPut();
break;
case Request::METHOD_DELETE:
if (LtiAssignmentGradesService::AGS_FULL !== $this->tool->getAdvantageServices()['ags']) {
throw new MethodNotAllowedHttpException([Request::METHOD_GET]);
}
$this->validateToken(
[LtiAssignmentGradesService::SCOPE_LINE_ITEM]
);

@ -67,6 +67,10 @@ class LtiLineItemsResource extends LtiAdvantageServiceResource
{
switch ($this->request->getMethod()) {
case Request::METHOD_POST:
if (LtiAssignmentGradesService::AGS_FULL !== $this->tool->getAdvantageServices()['ags']) {
throw new MethodNotAllowedHttpException([Request::METHOD_GET]);
}
$this->validateToken(
[
LtiAssignmentGradesService::SCOPE_LINE_ITEM,

Loading…
Cancel
Save