diff --git a/organizations/backends.py b/organizations/backends.py index e23d6a36..4d0164cd 100644 --- a/organizations/backends.py +++ b/organizations/backends.py @@ -70,25 +70,3 @@ def authenticate(self, *args, **kwargs): # pylint: disable=arguments-differ if site_organization in user_organizations: return user return None - - -class SiteMemberBackend(ModelBackend): - """ - Extension of the regular ModelBackend that will check whether the user is a member of the currently - active site. - - Deprecated: Should be removed because `UserSiteMapping` should be removed. - """ - - def authenticate(self, *args, **kwargs): # pylint: disable=arguments-differ - """ - Authenticate organization learners. - """ - user = super(SiteMemberBackend, self).authenticate(*args, **kwargs) - # superuser can log into any microsite - site = get_current_site() - is_default_site = site.id == settings.SITE_ID - if not is_default_site and is_site_configuration_enabled() and user and not user.is_superuser: - if user.id in site.usersitemapping_set.select_related('user').values_list('user__id', flat=True): - return user - return None diff --git a/organizations/migrations/0012_delete_usersitemapping.py b/organizations/migrations/0012_delete_usersitemapping.py new file mode 100644 index 00000000..bc081192 --- /dev/null +++ b/organizations/migrations/0012_delete_usersitemapping.py @@ -0,0 +1,16 @@ +# Generated by Django 2.2.12 on 2021-06-02 06:38 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organizations', '0011_historicalorganization_edx_uuid'), + ] + + operations = [ + migrations.DeleteModel( + name='UserSiteMapping', + ), + ] diff --git a/organizations/models.py b/organizations/models.py index 1109aa52..686847e4 100644 --- a/organizations/models.py +++ b/organizations/models.py @@ -121,16 +121,3 @@ def __str__(self): email=self.user.email, # pylint: disable=no-member organization=org.short_name, ) - - -class UserSiteMapping(models.Model): - """ - User membership in a site. - - Deprecated: Not used by Tahoe. Should be removed. - """ - - user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) - site = models.ForeignKey(Site, on_delete=models.CASCADE) - is_active = models.BooleanField(default=True) - is_amc_admin = models.BooleanField(default=False)