Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove lti_tools.proxy_launch #2965

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/docs/hosting/ca-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ tool**. Fill in the following and save:
- **Key**: The value of `LTI_CONSUMER_KEY`
- **Secret**: The value of `LTI_CONSUMER_SECRET`
- Tick the following:
- **Return proxied content URLs**
- **Deep Linking request to content URL**
- **Send full name of user to tool**
- **Send email address of user to tool**
Expand Down
1 change: 0 additions & 1 deletion sourcecode/hub/app/Console/Commands/AddLtiTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public function handle(): void
$tool->consumer_secret = $this->secret('Secret');
$tool->send_name = $this->option('send-name');
$tool->send_email = $this->option('send-email');
$tool->proxy_launch = true;

if ($this->option('slug')) {
$tool->slug = $this->option('slug');
Expand Down
1 change: 0 additions & 1 deletion sourcecode/hub/app/Http/Requests/StoreLtiToolRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public function rules(): array
'edit_mode' => ['required', Rule::enum(LtiToolEditMode::class)],
'send_name' => ['boolean'],
'send_email' => ['boolean'],
'proxy_launch' => ['boolean'],
'slug' => ['sometimes', 'string', 'max:50', 'regex:/^[a-z0-9-_]+$/'],
];
}
Expand Down
2 changes: 0 additions & 2 deletions sourcecode/hub/app/Http/Requests/UpdateLtiToolRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public function prepareForValidation(): void

$parameters->set('send_name', $parameters->getBoolean('send_name', false));
$parameters->set('send_email', $parameters->getBoolean('send_email', false));
$parameters->set('proxy_launch', $parameters->getBoolean('proxy_launch', false));
}

/**
Expand All @@ -40,7 +39,6 @@ public function rules(): array
'edit_mode' => ['required', Rule::enum(LtiToolEditMode::class)],
'send_name' => ['boolean'],
'send_email' => ['boolean'],
'proxy_launch' => ['boolean'],
'slug' => ['sometimes', 'string', 'max:50', 'regex:/^[a-z0-9-_]+$/'],
];
}
Expand Down
5 changes: 0 additions & 5 deletions sourcecode/hub/app/Models/ContentVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@ public function toItemSelectionRequest(): Oauth1Request
public function getExternalLaunchUrl(): string
{
$content = $this->content ?? throw new DomainException('No content for version');
$tool = $this->tool ?? throw new DomainException('No tool for LTI resource');

if (!$tool->proxy_launch) {
return $this->lti_launch_url;
}

if (session('lti.ext_edlib3_return_exact_version')) {
return route('lti.content-version', [
Expand Down
3 changes: 0 additions & 3 deletions sourcecode/hub/app/Models/LtiTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class LtiTool extends Model
'lti_version' => LtiVersion::Lti1_1,
'send_name' => false,
'send_email' => false,
'proxy_launch' => false,
'edit_mode' => LtiToolEditMode::Replace,
];

Expand All @@ -40,7 +39,6 @@ class LtiTool extends Model
'edit_mode' => LtiToolEditMode::class,
'send_name' => 'boolean',
'send_email' => 'boolean',
'proxy_launch' => 'boolean',
];

protected $hidden = [
Expand All @@ -54,7 +52,6 @@ class LtiTool extends Model
'consumer_secret',
'send_name',
'send_email',
'proxy_launch',
'edit_mode',
'slug',
];
Expand Down
2 changes: 1 addition & 1 deletion sourcecode/hub/app/Transformers/LtiToolTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public function transform(LtiTool $tool): array
'consumer_key' => $tool->consumer_key,
'deep_linking_url' => $tool->creator_launch_url,
'edit_mode' => $tool->edit_mode->value,
'proxies_lti_launches' => $tool->proxy_launch,
'send_email' => $tool->send_email,
'send_name' => $tool->send_name,
'proxies_lti_launches' => true, // deprecated
'links' => [
'self' => route('api.lti-tools.show', [$tool]),
],
Expand Down
6 changes: 0 additions & 6 deletions sourcecode/hub/database/factories/LtiToolFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public function definition(): array
'consumer_secret' => $this->faker->password(32),
'send_name' => $this->faker->boolean,
'send_email' => $this->faker->boolean,
'proxy_launch' => $this->faker->boolean,
'slug' => $this->faker->unique()->slug(nbWords: 2),
];
}
Expand All @@ -49,11 +48,6 @@ public function sendEmail(bool $sendEmail = true): self
return $this->state(['send_email' => $sendEmail]);
}

public function proxyLaunch(bool $proxyLaunch = true): self
{
return $this->state(['proxy_launch' => $proxyLaunch]);
}

public function withName(string $name): self
{
return $this->state(['name' => $name]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
public function up(): void
{
Schema::table('lti_tools', function (Blueprint $table) {
$table->dropColumn('proxy_launch');
});
}

public function down(): void
{
Schema::table('lti_tools', function (Blueprint $table) {
$table->boolean('proxy_launch')->default(true);
});
}
};
2 changes: 0 additions & 2 deletions sourcecode/hub/lang/en/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@
'send-email-to-lti-tool' => 'Send email address of :site user to tool',
'content-selection' => 'Content selection',
'launch-settings' => 'Launch settings',
'proxy-launch-to-lti-tool' => 'Return proxied content URLs',
'proxy-launch-to-lti-tool-help' => 'If enabled, the selected content will be shown through :site. Otherwise, the platform is required to have exchanged keys with the tool beforehand.',
'yes' => 'Yes',
'no' => 'No',
'continue' => 'Continue',
Expand Down
2 changes: 0 additions & 2 deletions sourcecode/hub/lang/nb/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@
'send-email-to-lti-tool' => 'Send epostadresse på :site-bruker til verktøy',
'content-selection' => 'Valg av innhold',
'launch-settings' => 'Oppstartsinnstillinger',
'proxy-launch-to-lti-tool' => 'Returner :site-URLer til verktøy',
'proxy-launch-to-lti-tool-help' => 'Om aktivert, vil innholdet bli vist gjennom :site. Ellers er plattformen påkrevd å ha utvekslet nøkler med verktøyet på forhånd.',
'yes' => 'Ja',
'no' => 'Nei',
'continue' => 'Fortsett',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@
<th scope="row">{{ trans('messages.send-email-to-lti-tool', ['site' => config('app.name')]) }}</th>
<td class="lti-tool-card-send-email">{{ $tool->send_email ? trans('messages.yes') : trans('messages.no') }}</td>
</tr>
<tr>
<th scope="row">{{ trans('messages.proxy-launch-to-lti-tool', ['site' => config('app.name')]) }}</th>
<td class="lti-tool-card-proxy-launch">{{ $tool->proxy_launch ? trans('messages.yes') : trans('messages.no') }}</td>
</tr>
</tbody>
</table>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@
:label="trans('messages.secret')"
/>

<fieldset>
<legend>{{ trans('messages.launch-settings') }}</legend>

<x-form.field
name="proxy_launch"
type="checkbox"
:label="trans('messages.proxy-launch-to-lti-tool', ['site' => config('app.name')])"
:text="trans('messages.proxy-launch-to-lti-tool-help', ['site' => config('app.name')])"
:checked="$tool?->proxy_launch"
/>
</fieldset>

<fieldset>
<legend>{{ trans('messages.edit-mode') }}</legend>

Expand Down
5 changes: 0 additions & 5 deletions sourcecode/hub/tests/Browser/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ public function testCanEditFlagsForTool(): void
->withName('The Tool')
->sendName()
->sendEmail()
->proxyLaunch()
->create();

$this->browse(
Expand All @@ -248,13 +247,10 @@ public function testCanEditFlagsForTool(): void
new LtiToolCard(),
fn(Browser $card) =>
$card
->assertSeeIn('@proxy-launch', 'Yes')
->assertSeeIn('@send-email', 'Yes')
->assertSeeIn('@send-name', 'Yes'),
)
->clickLink('Edit')
->assertChecked('proxy_launch')
->uncheck('proxy_launch')
->assertChecked('send_name')
->uncheck('send_name')
->assertChecked('send_email')
Expand All @@ -268,7 +264,6 @@ public function testCanEditFlagsForTool(): void
new LtiToolCard(),
fn(Browser $card) =>
$card
->assertSeeIn('@proxy-launch', 'No')
->assertSeeIn('@send-email', 'No')
->assertSeeIn('@send-name', 'No'),
),
Expand Down
1 change: 0 additions & 1 deletion sourcecode/hub/tests/Browser/Components/LtiToolCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function assert(Browser $browser): void
public function elements(): array
{
return [
'@proxy-launch' => '.lti-tool-card-proxy-launch',
'@send-email' => '.lti-tool-card-send-email',
'@send-name' => '.lti-tool-card-send-name',
];
Expand Down
2 changes: 1 addition & 1 deletion sourcecode/hub/tests/Feature/Api/LtiToolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testShowsLtiTool(): void
->missing('consumer_secret')
->where('deep_linking_url', $tool->creator_launch_url)
->where('edit_mode', $tool->edit_mode->value)
->where('proxies_lti_launches', $tool->proxy_launch)
->where('proxies_lti_launches', true)
->where('send_name', $tool->send_name)
->where('send_email', $tool->send_email)
->where('links.self', 'https://hub-test.edlib.test/api/lti-tools/' . $tool->id),
Expand Down
1 change: 0 additions & 1 deletion sourcecode/hub/tests/Feature/Commands/AddLtiToolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function testAddsLtiTool(): void
$this->assertSame('https://ca.edlib.test/lti-content/create', $tool->creator_launch_url);
$this->assertTrue($tool->send_name);
$this->assertTrue($tool->send_email);
$this->assertTrue($tool->proxy_launch);
$this->assertSame('h5p', $tool->consumer_key);
$this->assertSame('secret2', $tool->consumer_secret);
$this->assertSame(LtiToolEditMode::DeepLinkingRequestToContentUrl, $tool->edit_mode);
Expand Down
25 changes: 2 additions & 23 deletions sourcecode/hub/tests/Feature/ContentVersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Tests\Feature;

use App\Models\ContentVersion;
use App\Models\LtiTool;
use Illuminate\Foundation\Testing\RefreshDatabase;
use PHPUnit\Framework\Attributes\TestWith;
use Tests\TestCase;
Expand All @@ -30,28 +29,9 @@ public function testGivesScore(bool $expected, string $min, string $max): void
$this->assertSame($expected, $v->givesScore());
}

/** @param array<mixed> $session */
#[TestWith([[]])]
#[TestWith([['lti' => ['ext_edlib3_return_exact_version' => '1']]])]
public function testLaunchUrlIsUnproxiedWhenProxyingIsDisabled(array $session): void
public function testLaunchUrlIsExactVersionWhenSettingExistsInSession(): void
{
$version = ContentVersion::factory()
->tool(LtiTool::factory()->proxyLaunch(false))
->withLaunchUrl('https://example.com/launch')
->create();

$this->withSession($session);

$this->assertSame(
'https://example.com/launch',
$version->getExternalLaunchUrl(),
);
}

public function testLaunchUrlIsExactVersionWhenProxiedAndSettingExistsInSession(): void
{
$version = ContentVersion::factory()
->tool(LtiTool::factory()->proxyLaunch(true))
->withLaunchUrl('https://example.com/launch')
->create();

Expand All @@ -69,10 +49,9 @@ public function testLaunchUrlIsExactVersionWhenProxiedAndSettingExistsInSession(
);
}

public function testLaunchUrlIsLatestVersionOfContentByDefaultWhenProxyingIsEnabled(): void
public function testLaunchUrlIsLatestVersionOfContentByDefault(): void
{
$version = ContentVersion::factory()
->tool(LtiTool::factory()->proxyLaunch(true))
->withLaunchUrl('https://example.com/launch')
->create();

Expand Down