user lookup util
This commit is contained in:
committed by
Alex Dusenbery
parent
03db25bd50
commit
afe3cdb3ec
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.20 on 2019-04-18 20:33
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('organizations', '0006_auto_20171207_0259'),
|
||||
('third_party_auth', '0022_auto_20181012_0307'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='ltiproviderconfig',
|
||||
name='organization',
|
||||
field=models.OneToOneField(blank=True, help_text="optional. If this provider is an Organization, this attribute can be used reference users in that Organization", null=True, on_delete=django.db.models.deletion.CASCADE, to='organizations.Organization'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='oauth2providerconfig',
|
||||
name='organization',
|
||||
field=models.OneToOneField(blank=True, help_text="optional. If this provider is an Organization, this attribute can be used reference users in that Organization", null=True, on_delete=django.db.models.deletion.CASCADE, to='organizations.Organization'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='samlproviderconfig',
|
||||
name='organization',
|
||||
field=models.OneToOneField(blank=True, help_text="optional. If this provider is an Organization, this attribute can be used reference users in that Organization", null=True, on_delete=django.db.models.deletion.CASCADE, to='organizations.Organization'),
|
||||
),
|
||||
]
|
||||
@@ -16,6 +16,7 @@ from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from organizations.models import Organization
|
||||
from provider.oauth2.models import Client
|
||||
from provider.utils import long_token
|
||||
from social_core.backends.base import BaseAuth
|
||||
@@ -125,6 +126,16 @@ class ProviderConfig(ConfigurationModel):
|
||||
'in a separate list of "Institution" login providers.'
|
||||
),
|
||||
)
|
||||
organization = models.OneToOneField(
|
||||
Organization,
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=models.CASCADE,
|
||||
help_text=_(
|
||||
'optional. If this provider is an Organization, this attribute '
|
||||
'can be used reference users in that Organization'
|
||||
)
|
||||
)
|
||||
site = models.ForeignKey(
|
||||
Site,
|
||||
default=settings.SITE_ID,
|
||||
|
||||
@@ -64,9 +64,10 @@ class Oauth2ProviderConfigAdminTest(testutil.TestCase):
|
||||
# Remove the icon_image from the POST data, to simulate unchanged icon_image
|
||||
post_data = models.model_to_dict(provider1)
|
||||
del post_data['icon_image']
|
||||
# Remove max_session_length; it has a default null value which must be POSTed
|
||||
# Remove max_session_length and organization. A default null value must be POSTed
|
||||
# back as an absent value, rather than as a "null-like" included value.
|
||||
del post_data['max_session_length']
|
||||
del post_data['organization']
|
||||
|
||||
# Change the name, to verify POST
|
||||
post_data['name'] = 'Another name'
|
||||
|
||||
Reference in New Issue
Block a user