Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activity log for access #369

Merged
merged 6 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions core/forms/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def __init__(self, *args, **kwargs):
'user',
'project',
'defined_on_locations',
'granted_on',
'grant_expires_on',
'access_notes',
'granted_on'
'grant_expires_on'
]


Expand All @@ -50,11 +50,13 @@ class Meta:
}

field_order = [
'defined_on_locations',
'access_notes',
'contact',
'user',
'project',
'granted_on'
'grant_expires_on'
'defined_on_locations',
'granted_on',
'grant_expires_on',
'access_notes'
]

def __init__(self, *args, **kwargs):
Expand Down
6 changes: 5 additions & 1 deletion core/models/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from .utils import CoreModel
from model_utils import Choices

from auditlog.registry import auditlog


class StatusChoices(ChoiceEnum):
precreated = "Pre-created"
Expand Down Expand Up @@ -180,4 +182,6 @@ def is_active(self):
if self.grant_expires_on != None and self.grant_expires_on < datetime.now():
return False

return True
return True

auditlog.register(Access)
4 changes: 3 additions & 1 deletion elixir_daisy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
'django_celery_beat',
'celery_haystack',
'sequences.apps.SequencesConfig',
'explorer'
'explorer',
'auditlog'
]

MIDDLEWARE = [
Expand All @@ -75,6 +76,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'auditlog.middleware.AuditlogMiddleware',
'stronghold.middleware.LoginRequiredMiddleware',
]

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
'setuptools-scm==3.3.3',
'jsonschema==3.2.0',
'mockldap@git+https://github.com/elixir-luxembourg/mockldap2.git',
'django-auditlog==2.1.1',
]

test_requirements = [
Expand Down
1 change: 1 addition & 0 deletions web/views/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def edit_access(request, pk, dataset_pk):
{'type': 'Edit error', 'messages': [str(e) for e in form.errors]
}}, status=405)
else:
access.access_notes = None
form = AccessEditForm(instance=access)

log.debug(submit_url=request.get_full_path())
Expand Down