mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Renamed CreatedUpdatedModel to ChangeLoggedModel and applied it to all primary and organizational models
This commit is contained in:
35
netbox/secrets/migrations/0005_change_logging.py
Normal file
35
netbox/secrets/migrations/0005_change_logging.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.12 on 2018-06-13 17:29
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('secrets', '0004_tags'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='secretrole',
|
||||
name='created',
|
||||
field=models.DateField(auto_now_add=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='secretrole',
|
||||
name='last_updated',
|
||||
field=models.DateTimeField(auto_now=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='secret',
|
||||
name='created',
|
||||
field=models.DateField(auto_now_add=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='secret',
|
||||
name='last_updated',
|
||||
field=models.DateTimeField(auto_now=True, null=True),
|
||||
),
|
||||
]
|
@@ -14,7 +14,7 @@ from django.urls import reverse
|
||||
from django.utils.encoding import force_bytes, python_2_unicode_compatible
|
||||
from taggit.managers import TaggableManager
|
||||
|
||||
from utilities.models import CreatedUpdatedModel
|
||||
from utilities.models import ChangeLoggedModel
|
||||
from .exceptions import InvalidKey
|
||||
from .hashers import SecretValidationHasher
|
||||
from .querysets import UserKeyQuerySet
|
||||
@@ -48,12 +48,18 @@ def decrypt_master_key(master_key_cipher, private_key):
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class UserKey(CreatedUpdatedModel):
|
||||
class UserKey(models.Model):
|
||||
"""
|
||||
A UserKey stores a user's personal RSA (public) encryption key, which is used to generate their unique encrypted
|
||||
copy of the master encryption key. The encrypted instance of the master key can be decrypted only with the user's
|
||||
matching (private) decryption key.
|
||||
"""
|
||||
created = models.DateField(
|
||||
auto_now_add=True
|
||||
)
|
||||
last_updated = models.DateTimeField(
|
||||
auto_now=True
|
||||
)
|
||||
user = models.OneToOneField(
|
||||
to=User,
|
||||
on_delete=models.CASCADE,
|
||||
@@ -251,7 +257,7 @@ class SessionKey(models.Model):
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class SecretRole(models.Model):
|
||||
class SecretRole(ChangeLoggedModel):
|
||||
"""
|
||||
A SecretRole represents an arbitrary functional classification of Secrets. For example, a user might define roles
|
||||
such as "Login Credentials" or "SNMP Communities."
|
||||
@@ -277,6 +283,7 @@ class SecretRole(models.Model):
|
||||
blank=True
|
||||
)
|
||||
|
||||
serializer = 'ipam.api.secrets.SecretSerializer'
|
||||
csv_headers = ['name', 'slug']
|
||||
|
||||
class Meta:
|
||||
@@ -304,7 +311,7 @@ class SecretRole(models.Model):
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Secret(CreatedUpdatedModel):
|
||||
class Secret(ChangeLoggedModel):
|
||||
"""
|
||||
A Secret stores an AES256-encrypted copy of sensitive data, such as passwords or secret keys. An irreversible
|
||||
SHA-256 hash is stored along with the ciphertext for validation upon decryption. Each Secret is assigned to a
|
||||
@@ -340,6 +347,7 @@ class Secret(CreatedUpdatedModel):
|
||||
tags = TaggableManager()
|
||||
|
||||
plaintext = None
|
||||
serializer = 'ipam.api.secrets.SecretSerializer'
|
||||
csv_headers = ['device', 'role', 'name', 'plaintext']
|
||||
|
||||
class Meta:
|
||||
|
Reference in New Issue
Block a user