Skip to content

Commit

Permalink
Update with more conflict resolutions
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Lind committed May 4, 2024
1 parent f680df8 commit f41306f
Show file tree
Hide file tree
Showing 21 changed files with 41 additions and 768 deletions.
21 changes: 0 additions & 21 deletions buildly/management/commands/loadinitialdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,8 @@
from django.core.management.base import BaseCommand
from django.db import transaction

<<<<<<< HEAD
from core.models import (
ROLE_VIEW_ONLY,
ROLE_ORGANIZATION_ADMIN,
ROLE_WORKFLOW_ADMIN,
ROLE_WORKFLOW_TEAM,
Organization,
CoreUser,
CoreGroup,
OrganizationType,
)
=======
from core.models import ROLE_VIEW_ONLY, ROLE_ORGANIZATION_ADMIN, ROLE_WORKFLOW_ADMIN, ROLE_WORKFLOW_TEAM, \
Organization, CoreUser, CoreGroup, OrganizationType
>>>>>>> master

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -75,15 +62,7 @@ def _create_user(self):
logger.info("Creating Super User")
user_password = None
if settings.DEBUG:
<<<<<<< HEAD
user_password = (
settings.SUPER_USER_PASSWORD
if settings.SUPER_USER_PASSWORD
else 'zGtkgLvmNiKm'
)
=======
user_password = settings.SUPER_USER_PASSWORD if settings.SUPER_USER_PASSWORD else 'zGtkgLvmNiKm'
>>>>>>> master
elif settings.SUPER_USER_PASSWORD:
user_password = settings.SUPER_USER_PASSWORD
else:
Expand Down
14 changes: 1 addition & 13 deletions buildly/settings/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,11 @@
'social_core.backends.google.GoogleOAuth2',
'social_core.backends.microsoft.MicrosoftOAuth2',
'django.contrib.auth.backends.ModelBackend',
'oauth2_provider.backends.OAuth2Backend',
'rest_framework_simplejwt.authentication.JWTAuthentication',
]

AUTHENTICATION_BACKENDS = AUTHENTICATION_LDAP_BACKEND + AUTHENTICATION_BACKENDS

# Rest Framework OAuth2 and JWT
REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] += [
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
'oauth2_provider_jwt.authentication.JWTAuthentication',
]

# Auth Application
OAUTH_CLIENT_ID = os.getenv('OAUTH_CLIENT_ID', None)
Expand Down Expand Up @@ -116,14 +111,7 @@
# i.e. ['example.com', 'buildly.io','treeaid.org']
if os.getenv('SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS'):
SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS = os.getenv(
<<<<<<< HEAD
'SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS'
).split(',')
'SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS').split(',')

=======
'SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS').split(',')
>>>>>>> master
if os.getenv('SOCIAL_AUTH_MICROSOFT_WHITELISTED_DOMAINS'):
SOCIAL_AUTH_GOOGLE_MICROSOFT_DOMAINS = os.getenv(
'SOCIAL_AUTH_MICROSOFT_WHITELISTED_DOMAINS'
Expand Down
6 changes: 3 additions & 3 deletions buildly/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

DEBUG = False if os.getenv('DEBUG') == 'False' else True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["http://localhost:8000",]


# Application definition
Expand Down Expand Up @@ -41,7 +41,6 @@
'social_django',
# OAuth2
'oauth2_provider',
'oauth2_provider_jwt',
# swagger
'drf_yasg',
# health check
Expand Down Expand Up @@ -89,7 +88,7 @@
'social_django.context_processors.login_redirect',
],
'builtins': [ # TODO to delete?
'django.contrib.staticfiles.templatetags.staticfiles'
'django.templatetags.static'
],
},
}
Expand Down Expand Up @@ -151,6 +150,7 @@
'PAGINATE_BY': 10,
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication',
'rest_framework.authentication.SessionAuthentication', # TODO check if disable, and also delete CSRF
'rest_framework.authentication.TokenAuthentication',
],
Expand Down
14 changes: 0 additions & 14 deletions core/jwt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import jwt
from django.conf import settings
from oauth2_provider.models import RefreshToken

from core.models import CoreUser, Organization
from gateway.exceptions import PermissionDenied
Expand All @@ -25,19 +24,6 @@ def payload_enricher(request):
'core_user_uuid': user['core_user_uuid'],
'organization_uuid': str(user['organization__organization_uuid']),
}
elif request.POST.get('refresh_token'):
try:
refresh_token = RefreshToken.objects.get(
token=request.POST.get('refresh_token')
)
user = refresh_token.user
return {
'core_user_uuid': user.core_user_uuid,
'organization_uuid': str(user.organization.organization_uuid),
'username': user.username,
}
except RefreshToken.DoesNotExist:
logger.warning('RefreshToken not found.')
return {}


Expand Down

0 comments on commit f41306f

Please sign in to comment.