Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparent path master #358

Merged
merged 162 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
8446525
Update ISSUE_TEMPLATE.md
May 8, 2020
8b1bb38
update travis configs
May 9, 2020
6fddbe6
update travis configs
May 9, 2020
3bd0c35
Merge remote-tracking branch 'upstream/master'
May 10, 2020
109c646
move build to travis script
May 10, 2020
4a75e0d
update travis for aws
May 10, 2020
c4ea278
update travis for aws
May 11, 2020
5f82439
update travis for aws
May 11, 2020
6bb2130
update travis for aws
May 11, 2020
813e3b8
update travis for aws
May 11, 2020
5c4f196
update travis for aws
May 11, 2020
284c823
update travis for aws
May 11, 2020
565b580
update travis for aws
May 11, 2020
d5e7808
update travis for aws
May 11, 2020
3e719c8
update travis for aws
May 11, 2020
731212d
cleanup initital data
Jun 14, 2020
1ad1966
cleanup initital data
Jun 14, 2020
b148c9e
cleanup initital data
Jun 14, 2020
a80a7d5
remove organization_name
Jun 16, 2020
b31fc81
remove organization_name
Jun 17, 2020
d35d082
update travis var
Jun 18, 2020
c9c2d96
update travis var
Jun 18, 2020
aec2f69
update travis var
Jun 18, 2020
a05d287
revert keys
Jun 18, 2020
71fbd8c
fix org
Jun 18, 2020
9d572a3
fix org
Jun 18, 2020
e90cf33
fix org
Jun 18, 2020
c42f1d4
fix org
Jun 18, 2020
326eff3
fix org
Jun 18, 2020
9aee00a
fix org
Jun 18, 2020
9188eb8
fix org
Jun 18, 2020
a48e524
turn off tagged commits for builds
Jun 18, 2020
e752325
update docker compose with email host
Jul 15, 2020
e3f8a31
update docker compose with email host
Jul 15, 2020
756f786
update docker compose with email host
Jul 15, 2020
f61771d
update docker compose with email host
Jul 15, 2020
6ac09bd
add options function to gateway
Jul 16, 2020
f9ee4b6
update permissions with options
Jul 21, 2020
8b2112c
refactor: Allow organization name to be accepted when creating core user
Dec 1, 2020
a20738a
chore: Update initial setup
Dec 2, 2020
f783a6a
test: Refactored test cases for organization
Dec 2, 2020
46dac52
fix: Flake8 warnings
Dec 2, 2020
14f4339
Flake8 Error fixes
Dec 2, 2020
73fcaac
chore: Flake8 fixes for whitespaces and f-strings
Dec 2, 2020
2454248
chore: Resolved ContextualVersionConflict
Dec 2, 2020
73bffeb
chore: requests dependency version
Dec 2, 2020
fee8349
Merge pull request #26 from TransparentPath/feature/organization_name…
Jan 5, 2021
d517248
Changes for Oauth in Initial Script
Jan 20, 2021
02c90b3
Merge pull request #28 from TransparentPath/fix/loadinitialdata
Jan 20, 2021
d418f93
removed changed in gateway view to allow options methid from service
vishalajackus Jan 27, 2021
afc11e5
removed changed in gateway view to allow options methid from service
vishalajackus Jan 27, 2021
2616b22
Commenting out options function for options response of services
vishalajackus Jan 27, 2021
2b81d93
Merge pull request #30 from TransparentPath/options_method
Jan 28, 2021
a454509
email alert message for shipment to user
vishalajackus Feb 5, 2021
3223239
Use generalised function name
vishalajackus Feb 8, 2021
c32ca1e
initial commit
ashishkmishra36 Feb 9, 2021
a5ff0d8
added seperate endpoint for update
ashishkmishra36 Feb 10, 2021
341ee5d
Merge pull request #35 from TransparentPath/fix/edit-organization-name
vishalajackus Feb 10, 2021
8daa870
add more illutratative field in message
vishalajackus Feb 11, 2021
c01c660
remove commented code in html template of shipment alert
vishalajackus Feb 11, 2021
7dd78ae
modifify html template name to send email alert for shipment
vishalajackus Feb 11, 2021
30b1920
add white space
vishalajackus Feb 11, 2021
e9c305f
remove conflict
vishalajackus Feb 11, 2021
f42abcd
Merge pull request #33 from TransparentPath/tp_email_alert
ashishkmishra36 Feb 11, 2021
034dd40
Allow user to subscribe to email alert in Profile
ashishkmishra36 Feb 17, 2021
ede613c
fixed linting
ashishkmishra36 Feb 17, 2021
8a6cc28
changed shipment id to shipment_uuid
ashishkmishra36 Feb 17, 2021
7b573e7
Merge pull request #38 from TransparentPath/fix/allow-user-to-subscri…
Feb 17, 2021
eee0569
added email_alert_flag to CoreUser Serializer
ashishkmishra36 Feb 18, 2021
35dc0bb
fixed linting
ashishkmishra36 Feb 18, 2021
b93e128
Merge pull request #39 from TransparentPath/fix/allow-user-to-subscri…
ashishkmishra36 Feb 18, 2021
a81f287
added boolean field in organisation
vishalajackus Feb 25, 2021
506431a
Merge pull request #41 from TransparentPath/add_booleanfield
vishalajackus Feb 25, 2021
3e9cd80
Resolved issue in OPTIONS method via Core
Mar 9, 2021
4f5444a
Merge pull request #44 from TransparentPath/fix/options-resolution
vishalajackus Mar 9, 2021
456813e
TransparentPath/buildly-core/issues/45:add radis field in organization
vishalajackus Mar 16, 2021
0d10269
Merge pull request #46 from TransparentPath/add_radius
Mar 16, 2021
666f656
Added support for multiple email alerts
Mar 23, 2021
f15e56c
Merge pull request #47 from TransparentPath/feat/support-multiple-emails
Mar 23, 2021
7311d30
initial commit
ashishkmishra36 May 11, 2021
237b2aa
return only org names
ashishkmishra36 May 11, 2021
8b01b8e
removed debugging info
ashishkmishra36 May 11, 2021
a51d885
Merge pull request #49 from TransparentPath/list-of-existing-orgs
May 13, 2021
443c480
change in request format of email alert endpoint (#53)
vishalajackus Jun 2, 2021
bea2e45
Added consortium table and its endpoint (#50)
vishalajackus Jun 4, 2021
157350a
Added organization types (#56)
Jun 4, 2021
774f908
Approval email for newly registered users (#57)
Jun 9, 2021
df0d17c
Updated email template for alerts
Jun 9, 2021
b35bf26
Updated email template for alerts
Jun 9, 2021
660ab29
Organization names coming from open API as list of names (#60)
Jun 10, 2021
63af351
Merge pull request #61 from TransparentPath/feat#59/email-templates
vishalajackus Jun 10, 2021
ad8ab4c
Resolve permission issue for "/organization/fetch_orgs/" endpoint (#64)
vishalajackus Jun 11, 2021
703161b
Add API endpoint for organization type (#65)
vishalajackus Jun 11, 2021
3fe4554
change permission level
vishalajackus Jun 11, 2021
2adf39a
add create and edit date in organization type
vishalajackus Jun 11, 2021
8c1ff4d
change permission level to only organization admin
vishalajackus Jun 11, 2021
0dbcfeb
Merge pull request #66 from TransparentPath/change-permission
vishalajackus Jun 11, 2021
42dfbd0
Updated configuration for consortium (#70)
Jun 29, 2021
ac00d2e
Configuration for user alert preferences (#73)
Jul 7, 2021
493b62c
update consortium table for organization uuid (#75)
vishalajackus Jul 12, 2021
a5faff1
Modifications in email templates (#77)
Jul 13, 2021
eec3ef9
change permission level for consortium table (#79)
vishalajackus Jul 15, 2021
1d4ccc1
filter consortium by organization (#81)
vishalajackus Jul 16, 2021
53796ea
update consortium array field (#82)
vishalajackus Jul 20, 2021
2ee19dd
Changed permission level for consortium (#85)
Jul 22, 2021
2db3290
create consortium if custody create (#87)
vishalajackus Jul 29, 2021
d2f78ef
Fix issue for retrieve query by uuid (#88)
vishalajackus Aug 12, 2021
823eedd
Revert "Fix issue for retrieve query by uuid (#88)"
vishalajackus Aug 16, 2021
0aa608a
Merge pull request #90 from TransparentPath/revert-88-datamesh-uuid-fix
vishalajackus Aug 16, 2021
269d76b
Handled boolean for CORS_ORIGIN_ALLOW_ALL
Nov 19, 2021
e471e84
Updated Bravado Core version
Nov 24, 2021
006f70b
Merge pull request #95 from TransparentPath/fix/bravado-core-spec
mthombare Nov 24, 2021
9df8e88
Return response data only for PUT, POST, DELETE (#97)
Nov 26, 2021
dfb361e
Added default radius for organization
Feb 10, 2022
3f1b727
Merge pull request #100 from TransparentPath/fix#99/default-radius-or…
abhishek-kumar-piyush Feb 11, 2022
3b25820
Allow unlimited line size for request
Mar 1, 2022
711fbe9
Merge pull request #102 from TransparentPath/fix/gunicorn-config
abhishek-kumar-piyush Mar 3, 2022
87c45d2
sensor service email alert for unassigned moving sensor (#105)
abhishek-kumar-piyush Mar 25, 2022
f6ab185
Handle when no custody organization mapped to custodian
Mar 28, 2022
eceb280
Merge pull request #107 from TransparentPath/fix/custodian-no-organiz…
abhishek-kumar-piyush Mar 29, 2022
2492d66
Environmental warning timezone. (#108)
abhishek-kumar-piyush Apr 6, 2022
c79fba8
Remove Travis
RadhikaPPatel Apr 12, 2022
b444bd1
Remove timestamp from alert messages (#110)
abhishek-kumar-piyush Apr 20, 2022
5b3fc68
Gunicorn timeout configuration
Apr 27, 2022
f70809c
buildly-core gitHub actions (#112)
abhishek-kumar-piyush Jun 28, 2022
0961ca6
Remove dev deployment setup
patelradhika Feb 13, 2023
352d71f
Setup github actions
patelradhika Feb 13, 2023
8c0bd36
Bump the pip group group in /requirements with 6 updates
dependabot[bot] Feb 29, 2024
4f0337d
Update dev-build.yml
Mar 26, 2024
61e2651
Update base.txt
Mar 26, 2024
95b09ff
Merge pull request #131 from TransparentPath/dependabot/pip/requireme…
Mar 26, 2024
5a67276
[Security] Bump django from 2.2.10 to 2.2.13
dependabot-preview[bot] Jun 5, 2020
d33d153
replace buildly-ui to buildly-react-template
JiseonYu Jun 4, 2020
9e1ccd4
Issue #318: Bump django-oauth-toolkit from 1.3.0 to 1.3.2 (#325)
jefmoura Jun 22, 2020
56d007c
Create GitHub actions for reviews (#329)
jefmoura Oct 7, 2020
6b63938
Add CodeQL for code analysis (#331)
jefmoura Nov 18, 2020
ae3bdbc
feat: Create GitHub Actions workflow to publish Docker images (#332)
jefmoura Nov 25, 2020
eb6afee
fix: Fix the release workflow
jefmoura Nov 25, 2020
45ac2ec
fix: Fix the build & release from release workflow
jefmoura Nov 25, 2020
ffda38f
fix: Fix semantic release (#334)
jefmoura Dec 2, 2020
5cc8510
rm toladata text (#336)
karrla Feb 17, 2021
756c7cb
[Security] Bump django from 2.2.13 to 2.2.18 (#339)
dependabot-preview[bot] Mar 26, 2021
d8f35bb
[Security] Bump django from 2.2.18 to 2.2.24 (#341)
dependabot-preview[bot] Jun 30, 2021
98b6022
[Security] Bump aiohttp from 3.5.4 to 3.7.4 (#338)
dependabot-preview[bot] Jun 30, 2021
3a86880
feat: Bump djangorestframework from 3.9.4 to 3.11.2 (#340)
dependabot-preview[bot] Jun 30, 2021
1e2230c
Create CODE_OF_CONDUCT.md (#342)
Jan 12, 2022
87eabda
Update README.md
Jan 27, 2022
0895b29
Bump django from 2.2.24 to 2.2.27 in /requirements (#345)
dependabot[bot] Mar 21, 2022
5708f28
Upstream changes (Auto Approve, Social Auth, Test cases etc)
abhishek-kumar-piyush May 25, 2022
145c84c
Changes from Insights for login, datamesh and scripts to enhance data…
Aug 2, 2022
01c6177
Feat#113/upstream changes (#350)
abhishek-kumar-piyush Aug 2, 2022
d8c6c94
Bump djangorestframework from 3.9.4 to 3.11.2 in /requirements (#352)
dependabot[bot] Aug 2, 2022
3cb94f2
clean code to run locally (#354)
odenypeter Oct 14, 2022
696d741
Update README.md (#355)
Dec 6, 2023
3e0bba3
Update README.md
Dec 7, 2023
dc9aa7b
Update issue templates
Mar 6, 2024
4ef7467
Merge with massive style changes that should not have been there
Apr 5, 2024
52acab1
remove secrets
Apr 5, 2024
a6b2b06
merge
Apr 5, 2024
a2845ff
fix conflict
Apr 5, 2024
97fc6e8
fix conflict
Apr 5, 2024
db74f2e
fix conflict
Apr 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/demo-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and Push to Demo

on:
push:
branches:
- demo
jobs:
build:
name: Build and Push to GCR
runs-on: ubuntu-latest
env:
IMAGE_NAME: gcr.io/spry-bricolage-298920/transparent-path/demo/buildly-core
steps:
- uses: actions/checkout@v2

- name: Docker login
uses: docker/login-action@v1
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}

- name: Build docker image
run: docker build -t $IMAGE_NAME:latest .

- name: Push to Google Container Registry
run: docker push $IMAGE_NAME:latest
5 changes: 5 additions & 0 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ name: Build and Push to Development
on:
push:
branches:
<<<<<<< HEAD
- dev

=======
- master
>>>>>>> master
jobs:
build:
name: Build and Push to GCR
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: no-commit-to-branch
args: [--branch, prod, --branch, demo, --branch, dev]
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine3.10
FROM --platform=linux/amd64 python:3.7-alpine3.10

# Do not buffer log messages in memory; some messages can be lost otherwise
ENV PYTHONUNBUFFERED 1
Expand All @@ -21,5 +21,8 @@ RUN ./scripts/collectstatic.sh

RUN apk del .build-deps

# Specify tag name to be created on github
LABEL version="1.0.10"

EXPOSE 8080
ENTRYPOINT ["bash", "/code/scripts/docker-entrypoint.sh"]
33 changes: 30 additions & 3 deletions buildly/management/commands/loadinitialdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,21 @@
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 @@ -34,13 +47,19 @@ def _create_organization_types(self):

def _create_default_organization(self):
if settings.DEFAULT_ORG:
self._default_org, _ = Organization.objects.get_or_create(name=settings.DEFAULT_ORG)
self._default_org, _ = Organization.objects.get_or_create(
name=settings.DEFAULT_ORG
)

def _create_groups(self):
self._su_group = CoreGroup.objects.filter(is_global=True, permissions=15).first()
self._su_group = CoreGroup.objects.filter(
is_global=True, permissions=15
).first()
if not self._su_group:
logger.info("Creating global CoreGroup")
self._su_group = CoreGroup.objects.create(name='Global Admin', is_global=True, permissions=15)
self._su_group = CoreGroup.objects.create(
name='Global Admin', is_global=True, permissions=15
)

# TODO: remove this after full Group -> CoreGroup refactoring
self._groups.append(Group.objects.get_or_create(name=ROLE_VIEW_ONLY))
Expand All @@ -56,7 +75,15 @@ 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
66 changes: 39 additions & 27 deletions buildly/settings/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# Rest Framework OAuth2 and JWT
REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] += [
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
'oauth2_provider_jwt.authentication.JWTAuthentication'
'oauth2_provider_jwt.authentication.JWTAuthentication',
]

# Auth Application
Expand All @@ -50,28 +50,25 @@
AUTH_PASSWORD_VALIDATORS = []

AUTH_PASSWORD_VALIDATORS_MAP = {
'USE_PASSWORD_USER_ATTRIBUTE_SIMILARITY_VALIDATOR':
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
'USE_PASSWORD_MINIMUM_LENGTH_VALIDATOR':
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
'OPTIONS': {
'min_length': int(os.getenv('PASSWORD_MINIMUM_LENGTH', 6)),
}
},
'USE_PASSWORD_COMMON_VALIDATOR':
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
'USE_PASSWORD_NUMERIC_VALIDATOR':
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
'USE_PASSWORD_USER_ATTRIBUTE_SIMILARITY_VALIDATOR': {
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
},
'USE_PASSWORD_MINIMUM_LENGTH_VALIDATOR': {
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
'OPTIONS': {'min_length': int(os.getenv('PASSWORD_MINIMUM_LENGTH', 6))},
},
'USE_PASSWORD_COMMON_VALIDATOR': {
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'
},
'USE_PASSWORD_NUMERIC_VALIDATOR': {
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'
},
}

for password_validator_env_var, password_validator in AUTH_PASSWORD_VALIDATORS_MAP.items():
for (
password_validator_env_var,
password_validator,
) in AUTH_PASSWORD_VALIDATORS_MAP.items():
if os.getenv(password_validator_env_var, 'True') == 'True':
AUTH_PASSWORD_VALIDATORS.append(password_validator)

Expand All @@ -81,11 +78,13 @@
SOCIAL_AUTH_URL_NAMESPACE = 'social'
SOCIAL_AUTH_POSTGRES_JSONFIELD = True

SOCIAL_AUTH_REDIRECT_IS_HTTPS = True if os.getenv('SOCIAL_AUTH_REDIRECT_IS_HTTPS') == 'True' else False
SOCIAL_AUTH_REDIRECT_IS_HTTPS = (
True if os.getenv('SOCIAL_AUTH_REDIRECT_IS_HTTPS') == 'True' else False
)
SOCIAL_AUTH_LOGIN_REDIRECT_URLS = {
'github': os.getenv('SOCIAL_AUTH_GITHUB_REDIRECT_URL', None),
'google-oauth2': os.getenv('SOCIAL_AUTH_GOOGLE_OAUTH2_REDIRECT_URL', None),
'microsoft-graph': os.getenv('SOCIAL_AUTH_MICROSOFT_GRAPH_REDIRECT_URL', None)
'microsoft-graph': os.getenv('SOCIAL_AUTH_MICROSOFT_GRAPH_REDIRECT_URL', None),
}

SOCIAL_AUTH_PIPELINE = (
Expand Down Expand Up @@ -117,9 +116,18 @@
# 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').split(',')
SOCIAL_AUTH_GOOGLE_MICROSOFT_DOMAINS = os.getenv(
'SOCIAL_AUTH_MICROSOFT_WHITELISTED_DOMAINS'
).split(',')

# oauth2 settings
OAUTH2_PROVIDER = {
Expand All @@ -132,7 +140,9 @@
}

DEFAULT_OAUTH_DOMAINS = os.getenv('DEFAULT_OAUTH_DOMAINS', '')
CREATE_DEFAULT_PROGRAM = True if os.getenv('CREATE_DEFAULT_PROGRAM') == 'True' else False
CREATE_DEFAULT_PROGRAM = (
True if os.getenv('CREATE_DEFAULT_PROGRAM') == 'True' else False
)

# LDAP configuration
# https://django-auth-ldap.readthedocs.io/en/latest/reference.html#settings
Expand All @@ -147,7 +157,7 @@
AUTH_LDAP_USER_SEARCH = LDAPSearch(
AUTH_LDAP_BASE_DN,
ldap.SCOPE_SUBTREE,
f'{AUTH_LDAP_USERNAME_FIELD_SEARCH}=%(user)s'
f'{AUTH_LDAP_USERNAME_FIELD_SEARCH}=%(user)s',
)

AUTH_LDAP_USER_ATTR_MAP = {
Expand All @@ -157,4 +167,6 @@
'email': 'mail',
}
AUTH_LDAP_ALWAYS_UPDATE_USER = True
AUTH_LDAP_CACHE_TIMEOUT = 3600 # Cache distinguished names and group memberships for an hour to minimize
AUTH_LDAP_CACHE_TIMEOUT = (
3600
) # Cache distinguished names and group memberships for an hour to minimize
60 changes: 19 additions & 41 deletions buildly/settings/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os

# Base dir path
BASE_DIR = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

SECRET_KEY = os.environ['SECRET_KEY']

Expand All @@ -20,9 +19,7 @@

STATIC_URL = '/static/'

STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]


INSTALLED_APPS_DJANGO = [
Expand All @@ -40,31 +37,23 @@
'django_filters',
'rest_framework',
'rest_framework.authtoken',

# Social auth
'social_django',

# OAuth2
'oauth2_provider',
'oauth2_provider_jwt',

# swagger
'drf_yasg',

# health check
'health_check', # required
'health_check.db', # stock Django health checkers
'health_check', # required
'health_check.db', # stock Django health checkers
]

INSTALLED_APPS_LOCAL = [
'buildly',
'gateway',
'core',
'workflow',
'datamesh',
]
INSTALLED_APPS_LOCAL = ['buildly', 'gateway', 'core', 'workflow', 'datamesh']

INSTALLED_APPS = INSTALLED_APPS_DJANGO + INSTALLED_APPS_THIRD_PARTIES + INSTALLED_APPS_LOCAL
INSTALLED_APPS = (
INSTALLED_APPS_DJANGO + INSTALLED_APPS_THIRD_PARTIES + INSTALLED_APPS_LOCAL
)

MIDDLEWARE_DJANGO = [
'django.middleware.security.SecurityMiddleware',
Expand All @@ -76,13 +65,9 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

MIDDLEWARE_CSRF = [
'core.middleware.DisableCsrfCheck',
]
MIDDLEWARE_CSRF = ['core.middleware.DisableCsrfCheck']

EXCEPTION_MIDDLEWARE = [
'core.middleware.ExceptionMiddleware'
]
EXCEPTION_MIDDLEWARE = ['core.middleware.ExceptionMiddleware']

MIDDLEWARE = MIDDLEWARE_DJANGO + MIDDLEWARE_CSRF + EXCEPTION_MIDDLEWARE

Expand All @@ -91,9 +76,7 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
'templates',
],
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand All @@ -106,10 +89,10 @@
'social_django.context_processors.login_redirect',
],
'builtins': [ # TODO to delete?
'django.contrib.staticfiles.templatetags.staticfiles',
'django.contrib.staticfiles.templatetags.staticfiles'
],
},
},
}
]

WSGI_APPLICATION = 'buildly.wsgi.application'
Expand Down Expand Up @@ -171,17 +154,17 @@
'rest_framework.authentication.SessionAuthentication', # TODO check if disable, and also delete CSRF
'rest_framework.authentication.TokenAuthentication',
],
'DEFAULT_PERMISSION_CLASSES': (
'core.permissions.IsSuperUserBrowseableAPI',
)
'DEFAULT_PERMISSION_CLASSES': ('core.permissions.IsSuperUserBrowseableAPI',)
# ToDo: Think about `DEFAULT_PAGINATION_CLASS as env variable and
# customizable values with reasonable defaults
}

# Front-end application URL
FRONTEND_URL = os.getenv('FRONTEND_URL', 'http://www.example.com/')
REGISTRATION_URL_PATH = os.getenv('REGISTRATION_URL_PATH', 'register/')
RESETPASS_CONFIRM_URL_PATH = os.getenv('RESETPASS_CONFIRM_URL_PATH', 'reset_password_confirm/')
RESETPASS_CONFIRM_URL_PATH = os.getenv(
'RESETPASS_CONFIRM_URL_PATH', 'reset_password_confirm/'
)

PASSWORD_RESET_TIMEOUT_DAYS = 1

Expand All @@ -197,11 +180,6 @@

# Swagger settings - for generate_swagger management command

SWAGGER_SETTINGS = {
'DEFAULT_INFO': 'gateway.urls.swagger_info',
}
SWAGGER_SETTINGS = {'DEFAULT_INFO': 'gateway.urls.swagger_info'}

ORGANIZATION_TYPES = [
'Custodian',
'Producer'
]
ORGANIZATION_TYPES = ['Custodian', 'Producer']