Add api and audit structure
This commit is contained in:
parent
00cf64ef31
commit
d0a7bf5ecc
|
@ -0,0 +1,2 @@
|
||||||
|
"""passbook api"""
|
||||||
|
default_app_config = 'passbook.api.apps.PassbookAPIConfig'
|
|
@ -0,0 +1,10 @@
|
||||||
|
"""passbook API AppConfig"""
|
||||||
|
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
class PassbookAPIConfig(AppConfig):
|
||||||
|
"""passbook API Config"""
|
||||||
|
|
||||||
|
name = 'passbook.api'
|
||||||
|
label = 'passbook_api'
|
||||||
|
mountpoint = 'api/'
|
|
@ -0,0 +1,3 @@
|
||||||
|
"""passbook api urls"""
|
||||||
|
|
||||||
|
urlpatterns = []
|
|
@ -0,0 +1 @@
|
||||||
|
from rest_framework.viewsets import ViewSet
|
|
@ -0,0 +1,3 @@
|
||||||
|
"""passbook audit Header"""
|
||||||
|
__version__ = '0.0.1-alpha'
|
||||||
|
default_app_config = 'passbook.audit.apps.PassbookAuditConfig'
|
|
@ -0,0 +1,10 @@
|
||||||
|
"""passbook audit app"""
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class PassbookAuditConfig(AppConfig):
|
||||||
|
"""passbook audit app"""
|
||||||
|
|
||||||
|
name = 'passbook.audit'
|
||||||
|
label = 'passbook_audit'
|
||||||
|
mountpoint = 'audit/'
|
|
@ -0,0 +1,32 @@
|
||||||
|
# Generated by Django 2.1.3 on 2018-11-22 10:03
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='AuditEntry',
|
||||||
|
fields=[
|
||||||
|
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('action', models.TextField()),
|
||||||
|
('date', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('app', models.TextField()),
|
||||||
|
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,22 @@
|
||||||
|
"""passbook audit models"""
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
from reversion import register
|
||||||
|
|
||||||
|
from passbook.lib.models import UUIDModel
|
||||||
|
|
||||||
|
|
||||||
|
@register()
|
||||||
|
class AuditEntry(UUIDModel):
|
||||||
|
"""An individual audit log entry"""
|
||||||
|
|
||||||
|
user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL)
|
||||||
|
action = models.TextField()
|
||||||
|
date = models.DateTimeField(auto_now_add=True)
|
||||||
|
app = models.TextField()
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if self.pk:
|
||||||
|
raise NotImplementedError("you may not edit an existing %s" % self._meta.model_name)
|
||||||
|
super().save(*args, **kwargs)
|
|
@ -0,0 +1,2 @@
|
||||||
|
"""passbook audit urls"""
|
||||||
|
urlpatterns = []
|
|
@ -59,6 +59,7 @@ INSTALLED_APPS = [
|
||||||
'crispy_forms',
|
'crispy_forms',
|
||||||
'passbook.core',
|
'passbook.core',
|
||||||
'passbook.admin',
|
'passbook.admin',
|
||||||
|
'passbook.api',
|
||||||
'passbook.audit',
|
'passbook.audit',
|
||||||
'passbook.lib',
|
'passbook.lib',
|
||||||
'passbook.ldap',
|
'passbook.ldap',
|
||||||
|
|
Reference in New Issue