Project

General

Profile

Actions

Feature #5543

open

Repo API should have equivalent get_repo_audit_logs() to User API call get_user_audit_logs()

Added by Peter Colledge over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
26.02.2019
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:

Description

I achieved this with an over-simplified copy-and-paste for now:

diff --git a/rhodecode/api/views/repo_api.py b/rhodecode/api/views/repo_api.py
--- a/rhodecode/api/views/repo_api.py
+++ b/rhodecode/api/views/repo_api.py
@@ -2063,3 +2063,19 @@ def maintenance(request, apiuser, repoid
         log.exception("Exception occurred while trying to run maintenance")
         raise JSONRPCError(
             'Unable to execute maintenance on `%s`' % repo.repo_name)
+
+@jsonrpc_method()
+def get_repo_audit_logs(request, apiuser, repoid=Optional(OAttr('apirepo'))):
+    if not has_superadmin_permission(apiuser):
+        raise JSONRPCError('Access denied')
+
+    repoid = Optional.extract(repoid, evaluate_locals=locals())
+    repoid = getattr(repoid, 'repo_id', repoid)
+    repo = get_repo_or_error(repoid)
+
+    ret = []
+
+    # show all repo actions
+    for entry in RepoModel().get_repo_log(repo, filter_term=None):
+        ret.append(entry)
+    return ret

No data to display

Actions

Also available in: Atom PDF