Project

General

Custom queries

Profile

Actions

Feature #33551

closed

Audits should be searchable by the current user so a role with filter to "see my audits" can be created

Added by Marek Hulán over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Audit Log
Target version:
-
Fixed in Releases:
Found in Releases:

Added by Marek Hulán over 3 years ago

Revision b46326a4 (diff)

Fixes #33551 - allow searching audits by current_user

A user would like to define a filter that would allow all users to see
their own audits. The only thing that's missing is to define the
scoped_search on Audit model that would accept the current_user value
for audits' user_id and user.

This PR allows to search audits by the following terms

```
user.id = 1
user.id = 100
user.id = current_user

user = admin
user = current_user
```

the syntax is consitent with other places we have similar support (e.g.
the tasks).

Added by Marek Hulán over 3 years ago

Revision dc1ac386 (diff)

Refs #33551 - fix the searching in audits by user

The first PR allowed to search in search_users relation, however that
searches on the actual audited objects. So when used in filters, it
would grant access to see all audits of $my account by anyone. While
such search may still be useful, the original intention was to allow
searching by the author of the audit.

Given the user is already a search keyword, we call this
authored_by_user. The correct syntax then is

authored_by_user = admin
authored_by_user = current_user

authored_by_user.id = 2
authored_by_user.id = current_user

Actions

Also available in: Atom PDF