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

feat: auditlog #157

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

feat: auditlog #157

wants to merge 6 commits into from

Conversation

deepakdinesh1123
Copy link
Contributor

@deepakdinesh1123 deepakdinesh1123 commented Mar 18, 2024

fixes #166

@shahharsh176
Copy link
Contributor

@deepakdinesh1123 we can remove the enterprise folder as now auditlog is shifted to apps

@@ -15,6 +15,7 @@
from zelthy.api.platform.packages.v1 import urls as packages_v1_urls
from zelthy.api.platform.tasks.v1 import urls as tasks_v1_urls
from zelthy.api.platform.codeassist.v1 import urls as codeassist_v1_urls
from zelthy.api.platform.audit.v1 import urls as audit_v1_urls
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

audit can be changed to auditlog

@@ -57,5 +58,6 @@
re_path(r"^(?P<app_uuid>[\w-]+)/packages/$", include(packages_v1_urls)),
re_path(r"^(?P<app_uuid>[\w-]+)/tasks/", include(tasks_v1_urls)),
re_path(r"^(?P<app_uuid>[\w-]+)/code-assist/", include(codeassist_v1_urls)),
re_path(r"^(?P<app_uuid>[\w-]+)/audit/", include(audit_v1_urls)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auditlog

from .serializers import AuditLogSerializerModel


class AuditLogViewAPIV1(ZelthyGenericPlatformAPIView, ZelthyAPIPagination):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we can attach set_app_schema_path decorator. Refer to the task APIs or tenancy views

search = request.GET.get("search", None)
columns = get_search_columns(request)
connection.set_tenant(tenant)
with connection.cursor() as c:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we attach set_app_schema_path, we don't need to change the connection explicitly

@@ -0,0 +1,3 @@
# from importlib.metadata import version

# __version__ = version("django-auditlog")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is not need needed pls remove the commented code

changes = models.JSONField(null=True, verbose_name=_("change message"))
tenant_actor = models.ForeignKey(
to="appauth.AppUserModel",
on_delete=models.DO_NOTHING,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can change the on_delete to models.SET_NULL

)
platform_actor = models.ForeignKey(
to="platformauth.PlatformUserModel",
on_delete=models.DO_NOTHING,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the on_delete to models.SET_NULL

kwargs.setdefault("additional_data", get_additional_data())
db = instance._state.db
try:
obj = ObjectStore.objects.get(object_uuid=instance.object_uuid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also handle the case where objectstore doesn't contain the object with given instance.object_uuid, in this case code shouldn't break, object_ref can be None in that case

@@ -0,0 +1,12 @@
from django.db import models
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the exportjob as of now

urlpatterns += [
path("__debug__/", include("debug_toolbar.urls")),
]
# urlpatterns += [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls revert this change

@@ -7,12 +7,12 @@
re_path(r"^", include("zelthy.apps.appauth.urls")),
re_path(r"api/auth/", include("knox.urls")),
re_path(r"api/", include("zelthy.api.app_auth.urls")),
path("__debug__/", include("debug_toolbar.urls")),
# path("__debug__/", include("debug_toolbar.urls")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls revert this change

urlpatterns += [
path("__debug__/", include("debug_toolbar.urls")),
]
# urlpatterns += [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls revert this change

@shahharsh176
Copy link
Contributor

shahharsh176 commented Apr 12, 2024

@deepakdinesh1123 should we change "api/platform/auditlog" folder to api/platform/auditlogs to be in sync with app name auditlogs ?

add: audit logs

unused build removed
@shahharsh176 shahharsh176 changed the title auditlog added to enterprise folder feat: auditlog May 3, 2024
@@ -106,6 +106,46 @@ export default function SideMenu() {
Packages
</span>
</NavLink>
{/* <NavLink
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls remove unnecessary commented code

@@ -0,0 +1,130 @@
import { createSlice } from '@reduxjs/toolkit';

export const appAccessLogsSlice = createSlice({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accesslog related code should not be included in this PR.

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets have a readme file in this folder where we detail out:

  • which version of auditlog library we have taken
  • what changes have we made
  • overall rationale
  • How is it being used, how to exclude model, fields, etc.
    Also include a section in Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Audit logs
4 participants