-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from thalesgroup-cert/test
v2.0 Release
- Loading branch information
Showing
24 changed files
with
2,828 additions
and
5,325 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,4 +1,4 @@ | ||
FROM nikolaik/python-nodejs:python3.8-nodejs16 | ||
FROM nikolaik/python-nodejs:python3.11-nodejs18 | ||
MAINTAINER Félix HERRENSCHMIDT <[email protected]> | ||
|
||
# Adding backend directory to make absolute filepaths consistent across services | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,27 @@ | ||
# Generated by Django 5.0.2 on 2024-07-24 12:07 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('knox', '0008_remove_authtoken_salt'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='APIKey', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('auth_token', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='knox.authtoken')), | ||
], | ||
options={ | ||
'verbose_name': 'API Key', | ||
'verbose_name_plural': 'API Keys', | ||
}, | ||
), | ||
] |
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,11 +1,26 @@ | ||
from django.db import models | ||
from django_auth_ldap.backend import populate_user | ||
from django.contrib.auth.models import User | ||
from knox.models import AuthToken | ||
|
||
|
||
class APIKey(models.Model): | ||
""" | ||
Manages creation, modification, and deletion of user API keys. | ||
""" | ||
auth_token = models.OneToOneField(AuthToken, on_delete=models.CASCADE, null=True, blank=True) | ||
|
||
def __str__(self): | ||
return f"API Key for {self.auth_token.user.username}" | ||
|
||
class Meta: | ||
verbose_name = "API Key" | ||
verbose_name_plural = "API Keys" | ||
app_label = 'accounts' | ||
|
||
|
||
def make_inactive(sender, user, **kwargs): | ||
if not User.objects.filter(username=user.username): | ||
user.is_active = False | ||
|
||
|
||
populate_user.connect(make_inactive) | ||
populate_user.connect(make_inactive) |
Oops, something went wrong.