misc: remove imports from django_rbac (#71146)
This commit is contained in:
parent
a44ad680db
commit
85d6ab8ae0
|
@ -16,16 +16,17 @@
|
|||
|
||||
import django.apps
|
||||
from django.conf import settings
|
||||
from django_rbac.utils import get_ou_model
|
||||
|
||||
|
||||
class AppConfig(django.apps.AppConfig):
|
||||
name = 'authentic2_gnm'
|
||||
|
||||
def a2_hook_auth_oidc_backend_modify_user(self, user, user_info, **kwargs):
|
||||
from authentic2.a2_rbac.models import OrganizationalUnit
|
||||
|
||||
if not hasattr(settings, 'CUT_GNM_OU_MAPPING'):
|
||||
return False
|
||||
ou_map = {ou.slug: ou for ou in get_ou_model().cached()}
|
||||
ou_map = {ou.slug: ou for ou in OrganizationalUnit.cached()}
|
||||
# move user to the correct organizational unit
|
||||
user_ou_slug = settings.CUT_GNM_OU_MAPPING.get(user_info.get('ou'))
|
||||
if user_ou_slug:
|
||||
|
|
|
@ -10,14 +10,13 @@ try:
|
|||
except ImportError:
|
||||
import pathlib2 as pathlib
|
||||
|
||||
from authentic2.a2_rbac.models import OrganizationalUnit as OU
|
||||
from authentic2.a2_rbac.utils import get_default_ou
|
||||
from authentic2_auth_oidc.models import OIDCProvider
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.core.management import call_command
|
||||
from django_rbac.utils import get_ou_model
|
||||
|
||||
User = get_user_model()
|
||||
OU = get_ou_model()
|
||||
TEST_DIR = pathlib.Path(__file__).parent
|
||||
|
||||
|
||||
|
|
Reference in New Issue