-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6cf1b1
commit 8074666
Showing
25 changed files
with
265 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
|
||
|
||
admin.site.register(LtiConfiguration) | ||
admin.site.register(LtiAgsLineItem) | ||
admin.site.register(LtiAgsLineItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
lti_consumer/lti_1p3/extensions/rest_framework/permissions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from rest_framework import permissions | ||
|
||
from lti_consumer.lti_1p3 import exceptions | ||
|
||
|
||
class LtiAgsPermissions(permissions.BasePermission): | ||
def has_permission(self, request, view): | ||
if view.action in ['list', 'retrieve']: | ||
try: | ||
request.lti_consumer.check_token( | ||
request.lti_auth_token, | ||
[ | ||
'https://purl.imsglobal.org/spec/lti-ags/scope/lineitem.readonly', | ||
'https://purl.imsglobal.org/spec/lti-ags/scope/lineitem', | ||
], | ||
) | ||
return True | ||
except exceptions.UnauthorizedToken: | ||
return False | ||
elif view.action in ['create', 'update', 'partial_update', 'delete']: | ||
try: | ||
request.lti_consumer.check_token( | ||
request.lti_auth_token, | ||
'https://purl.imsglobal.org/spec/lti-ags/scope/lineitem' | ||
) | ||
return True | ||
except exceptions.UnauthorizedToken: | ||
return False | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 2.2.14 on 2020-07-17 17:12 | ||
|
||
from django.db import migrations, models | ||
import opaque_keys.edx.django.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='LtiConfiguration', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('version', models.CharField(choices=[('LTI_1P1', 'LTI 1.3'), ('LTI_1P3', 'LTI 1.3 (with LTI Advantage Support)')], default='LTI_1P1', max_length=10)), | ||
('config_store', models.CharField(choices=[('CONFIG_ON_XBLOCK', 'Configuration Stored on XBlock fields')], default='CONFIG_ON_XBLOCK', max_length=10)), | ||
('location', opaque_keys.edx.django.models.UsageKeyField(blank=True, db_index=True, max_length=255, null=True)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 2.2.14 on 2020-07-17 17:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('lti_consumer', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='lticonfiguration', | ||
name='version', | ||
field=models.CharField(choices=[('LTI_1P1', 'LTI 1.1'), ('LTI_1P3', 'LTI 1.3 (with LTI Advantage Support)')], default='LTI_1P1', max_length=10), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 2.2.14 on 2020-07-17 17:22 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('lti_consumer', '0002_auto_20200717_1720'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='lticonfiguration', | ||
name='config_store', | ||
field=models.CharField(choices=[('CONFIG_ON_XBLOCK', 'Configuration Stored on XBlock fields')], default='CONFIG_ON_XBLOCK', max_length=25), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 2.2.14 on 2020-07-17 17:44 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import opaque_keys.edx.django.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('lti_consumer', '0003_auto_20200717_1722'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='LtiAgsLineItem', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('resource_id', models.CharField(blank=True, max_length=50)), | ||
('resource_link_id', opaque_keys.edx.django.models.UsageKeyField(blank=True, db_index=True, max_length=255, null=True)), | ||
('score_maximum', models.IntegerField()), | ||
('tag', models.CharField(blank=True, max_length=50)), | ||
('start_date_time', models.DateTimeField(blank=True)), | ||
('end_date_time', models.DateTimeField(blank=True)), | ||
('lti_configuration', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lti_consumer.LtiConfiguration')), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 2.2.14 on 2020-07-17 18:27 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('lti_consumer', '0004_ltiagslineitem'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='ltiagslineitem', | ||
name='label', | ||
field=models.CharField(default='', max_length=100), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name='ltiagslineitem', | ||
name='resource_id', | ||
field=models.CharField(blank=True, max_length=100), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 2.2.14 on 2020-07-17 18:28 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('lti_consumer', '0005_auto_20200717_1827'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='ltiagslineitem', | ||
name='end_date_time', | ||
field=models.DateTimeField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='ltiagslineitem', | ||
name='start_date_time', | ||
field=models.DateTimeField(blank=True, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 2.2.14 on 2020-07-17 20:11 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('lti_consumer', '0006_auto_20200717_1828'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='ltiagslineitem', | ||
name='lti_configuration', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='lti_consumer.LtiConfiguration'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,4 +163,4 @@ def __str__(self): | |
return "{} - {}".format( | ||
self.resource_link_id, | ||
self.label, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,4 +62,4 @@ class Meta: | |
'resourceLinkId', | ||
'startDateTime', | ||
'endDateTime', | ||
) | ||
) |
Oops, something went wrong.