Skip to content

Commit

Permalink
make it proxy again
Browse files Browse the repository at this point in the history
  • Loading branch information
omercnet committed Sep 6, 2023
1 parent 60362bc commit c76af9f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
28 changes: 28 additions & 0 deletions django_descope/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 3.2.16 on 2022-11-26 18:42

import django.contrib.auth.models
from django.db import migrations


class Migration(migrations.Migration):
initial = True

dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
]

operations = [
migrations.CreateModel(
name="DescopeUser",
fields=[],
options={
"proxy": True,
"indexes": [],
"constraints": [],
},
bases=("auth.user",),
managers=[
("objects", django.contrib.auth.models.UserManager()),
],
),
]
7 changes: 4 additions & 3 deletions django_descope/models.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import logging

from descope import SESSION_TOKEN_NAME
from django.contrib.auth import get_user_model
from django.contrib import auth
from django.core.cache import cache

from . import descope_client
from .settings import IS_STAFF_ROLE, IS_SUPERUSER_ROLE

logger = logging.getLogger(__name__)

user_model = get_user_model()

class DescopeUser(auth.get_user_model()):
class Meta:
proxy = True

class DescopeUser(user_model):
# User is always active since Descope will never issue a token for an
# inactive user
is_active = True
Expand Down

0 comments on commit c76af9f

Please sign in to comment.