This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit eafb066a1f99db99ecc7abd297f79f523022b01d
Author: Daniel Gruno <[email protected]>
AuthorDate: Wed Mar 31 12:17:11 2021 +0200

    add 'log' command for viewing the log
---
 server/endpoints/mgmt.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/server/endpoints/mgmt.py b/server/endpoints/mgmt.py
index f13dd0f..7fafb13 100644
--- a/server/endpoints/mgmt.py
+++ b/server/endpoints/mgmt.py
@@ -38,8 +38,17 @@ async def process(
     if not session.credentials.admin or not server.config.ui.mgmt_enabled:
         return aiohttp.web.Response(headers={}, status=403, text="You need 
administrative access to use this feature.")
 
+    # Viewing audit log?
+    if action == "log":
+        numentries = int(indata.get("size", 50))
+        page = int(indata.get("page", 0))
+        out = []
+        async for entry in plugins.auditlog.view(session, page=page, 
num_entries=numentries, raw=True):
+            out.append(entry)
+        return out
+
     # Deleting/hiding a document?
-    if action == "delete":
+    elif action == "delete":
         delcount = 0
         for doc in docs:
             assert isinstance(doc, str), "Document ID must be a string"

Reply via email to