Commit d0a7bf5e authored by Jens Langhammer's avatar Jens Langhammer

Add api and audit structure

parent 00cf64ef
"""passbook api"""
default_app_config = 'passbook.api.apps.PassbookAPIConfig'
"""passbook API AppConfig"""
from django.apps import AppConfig
class PassbookAPIConfig(AppConfig):
"""passbook API Config"""
name = 'passbook.api'
label = 'passbook_api'
mountpoint = 'api/'
"""passbook api urls"""
urlpatterns = []
from rest_framework.viewsets import ViewSet
"""passbook audit Header"""
__version__ = '0.0.1-alpha'
default_app_config = 'passbook.audit.apps.PassbookAuditConfig'
"""passbook audit app"""
from django.apps import AppConfig
class PassbookAuditConfig(AppConfig):
"""passbook audit app"""
name = 'passbook.audit'
label = 'passbook_audit'
mountpoint = 'audit/'
# 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,
},
),
]
"""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)
"""passbook audit urls"""
urlpatterns = []
......@@ -59,6 +59,7 @@ INSTALLED_APPS = [
'crispy_forms',
'passbook.core',
'passbook.admin',
'passbook.api',
'passbook.audit',
'passbook.lib',
'passbook.ldap',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment