-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into global_setting_for_default_language
- Loading branch information
Showing
53 changed files
with
396 additions
and
581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,11 +49,14 @@ jobs: | |
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: latest | ||
- name: Install requirements | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: false | ||
installer-parallel: true | ||
- name: Install backend requirements | ||
working-directory: ${{ env.backend-directory }} | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
run: poetry install | ||
- name: Install dependencies | ||
working-directory: ${{ env.frontend-directory }} | ||
run: | | ||
|
@@ -72,6 +75,8 @@ jobs: | |
working-directory: ${{ env.backend-directory }} | ||
run: | | ||
touch .env | ||
echo LOG_LEVEL=DEBUG >> .env | ||
echo LOG_OUTFILE=ciso-assistant.log >> .env | ||
echo DJANGO_DEBUG=True >> .env | ||
echo [email protected] >> .env | ||
echo DJANGO_SUPERUSER_PASSWORD=1234 >> .env | ||
|
@@ -90,14 +95,14 @@ jobs: | |
working-directory: ${{ env.backend-directory }} | ||
run: | | ||
export $(grep -v '^#' .env | xargs) | ||
python manage.py makemigrations | ||
python manage.py migrate | ||
poetry run python manage.py makemigrations | ||
poetry run python manage.py migrate | ||
- name: Start test server | ||
working-directory: ${{ env.backend-directory }} | ||
run: | | ||
export $(grep -v '^#' .env | xargs) | ||
python manage.py createsuperuser --noinput | ||
nohup python manage.py runserver & | ||
poetry run python manage.py createsuperuser --noinput | ||
nohup poetry run python manage.py runserver & | ||
- name: Build frontend | ||
working-directory: ${{ env.frontend-directory }} | ||
run: pnpm run build | ||
|
@@ -111,6 +116,7 @@ jobs: | |
with: | ||
name: functional-tests-report-${{ matrix.playwright-browser }} | ||
path: | | ||
${{ env.backend-directory }}/*.log | ||
${{ env.frontend-directory }}/tests/results/ | ||
${{ env.frontend-directory }}/tests/reports/ | ||
retention-days: 5 | ||
|
@@ -173,6 +179,8 @@ jobs: | |
working-directory: ${{ env.backend-directory }} | ||
run: | | ||
touch .env | ||
echo LOG_LEVEL=DEBUG >> .env | ||
echo LOG_OUTFILE=ciso-assistant.log >> .env | ||
echo DJANGO_DEBUG=True >> .env | ||
echo [email protected] >> .env | ||
echo DJANGO_SUPERUSER_PASSWORD=1234 >> .env | ||
|
@@ -198,7 +206,7 @@ jobs: | |
working-directory: ${{ env.backend-directory }} | ||
run: | | ||
export $(grep -v '^#' .env | xargs) | ||
poetry run python manage.py createsuperuser --noinput | ||
poetry run python manage.py createsuperuser --noinput --settings=${{ env.enterprise-backend-settings-module }} | ||
nohup poetry run python manage.py runserver --settings=${{ env.enterprise-backend-settings-module }} & | ||
- name: Run tests with browser ${{ matrix.playwright-browser }} | ||
working-directory: ${{ env.enterprise-frontend-build-directory }} | ||
|
@@ -210,6 +218,7 @@ jobs: | |
with: | ||
name: enterprise-functional-tests-report-${{ matrix.playwright-browser }} | ||
path: | | ||
${{ env.backend-directory }}/*.log | ||
${{ env.enterprise-frontend-build-directory }}/tests/results/ | ||
${{ env.enterprise-frontend-build-directory }}/tests/reports/ | ||
retention-days: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,8 @@ jobs: | |
working-directory: ${{ env.backend-directory }} | ||
run: | | ||
touch .env | ||
echo LOG_LEVEL=DEBUG >> .env | ||
echo LOG_OUTFILE=ciso-assistant.log >> .env | ||
echo DJANGO_DEBUG=True >> .env | ||
echo [email protected] >> .env | ||
echo DJANGO_SUPERUSER_PASSWORD=1234 >> .env | ||
|
@@ -98,6 +100,7 @@ jobs: | |
with: | ||
name: startup-functional-test-report | ||
path: | | ||
${{ env.backend-directory }}/*.log | ||
${{ env.frontend-directory }}/tests/reports/ | ||
retention-days: 5 | ||
|
||
|
@@ -196,6 +199,8 @@ jobs: | |
working-directory: ${{ env.backend-directory }} | ||
run: | | ||
touch .env | ||
echo LOG_LEVEL=DEBUG >> .env | ||
echo LOG_OUTFILE=ciso-assistant.log >> .env | ||
echo DJANGO_DEBUG=True >> .env | ||
echo [email protected] >> .env | ||
echo DJANGO_SUPERUSER_PASSWORD=1234 >> .env | ||
|
@@ -215,7 +220,7 @@ jobs: | |
working-directory: ${{ env.backend-directory }} | ||
run: | | ||
export $(grep -v '^#' .env | xargs) | ||
poetry run python manage.py createsuperuser --noinput | ||
poetry run python manage.py createsuperuser --noinput --settings=${{ env.enterprise-backend-settings-module }} | ||
nohup poetry run python manage.py runserver --settings=${{ env.enterprise-backend-settings-module }} & | ||
- name: Run tests | ||
working-directory: ${{ env.enterprise-frontend-build-directory }} | ||
|
@@ -225,6 +230,7 @@ jobs: | |
with: | ||
name: enterprise-startup-functional-test-report | ||
path: | | ||
${{ env.backend-directory }}/*.log | ||
${{ env.enterprise-frontend-build-directory }}/tests/reports/ | ||
retention-days: 5 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
*.sqlite3 | ||
django_secret_key | ||
temp/ | ||
./db/ | ||
db/ | ||
.dccache | ||
/backend/profiles | ||
./backend/ciso_assistant/.meta | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ db/pg_password.txt | |
.coverage | ||
pytest-report.html | ||
enterprise/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
from datetime import datetime | ||
|
||
import structlog | ||
from rest_framework import permissions | ||
|
||
logger = structlog.get_logger(__name__) | ||
|
||
|
||
class LicensePermission(permissions.BasePermission): | ||
def has_permission(self, request, view): | ||
expiration_date_str = os.environ.get("LICENSE_EXPIRATION") | ||
|
||
if not expiration_date_str: | ||
# Handle the case where no expiration date is set | ||
logger.warning("License expiration date is not set.") | ||
return True | ||
|
||
try: | ||
expiration_date = datetime.fromisoformat(expiration_date_str) | ||
except ValueError: | ||
logger.error( | ||
"Invalid expiration date format. Expiration date should follow ISO 8601 format.", | ||
expiration_date=expiration_date_str, | ||
) | ||
return False | ||
|
||
if expiration_date < datetime.now(): | ||
# License has expired, only allow read operations | ||
if request.method not in permissions.SAFE_METHODS: | ||
logger.warning( | ||
"License has expired, only read operations are allowed.", | ||
expiration_date=expiration_date, | ||
) | ||
return False | ||
|
||
# License is valid, allow all operations | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
from django.urls import include, path | ||
|
||
|
||
from .views import get_build | ||
from .views import LicenseStatusView, get_build | ||
|
||
urlpatterns = [ | ||
path("build/", get_build, name="get_build"), | ||
path("license-status/", LicenseStatusView.as_view(), name="license-status"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.