Issue 45347: Audit table data not available in linked schema

issues
Status:closed
Assigned To:Guest
Type:Defect
Area:Auditing
Priority:3
Milestone:22.07
Opened:2022-04-27 12:12 by martyp
Changed:2022-07-18 13:07 by Sweta Jewargikar
Resolved:2022-05-02 16:34 by jeckels
Resolution:Fixed
Related:45330
Support Ticket:45330
Pull Requests:platform#3308
Closed:2022-07-18 13:07 by Sweta Jewargikar
2022-04-27 12:12 martyp
Title»Audit table data not available in linked schema
Assigned To»triage
Notify»adam;jeckels
Type»Defect
Area»Auditing
Priority»2
Milestone»22.07
Related»45330
Support Ticket»45330
Repro: Create a Linked schema to audit tables or a query using audit tables in another container.
Expected: Able to view the audit data from the linked container
Actual: No data visible

Use case: Creating an ETL with a linked schema as the source. Audit logs provide the deleted rows source for the incremental filter. This is how we are currently telling EHR users to get Animal sources into Sample Manager.

2022-04-27 13:08 martyp
Looks like the db query is still filtering on the source container, instead of the container defining the linked schema.

2022-04-27 17:26 jeckels
The problem is that linked schemas only grant ReaderRole:

https://github.com/LabKey/platform/blob/be8b4dcc22614540a58de4ce06e6c86728fc48dd/query/src/org/labkey/query/LinkedSchema.java#L589

but the audit tables check for CanSeeAuditLogPermission:

https://github.com/LabKey/platform/blob/36cbc31000b7f68df925634bf466d78d6ff3be0c/api/src/org/labkey/api/audit/query/DefaultAuditTypeTable.java#L144

A tacky but not insane idea would be to check the name of the source schema and if it's "auditLog", grant both ReaderRole and CanSeeAuditLogRole. You have to be a site admin to set up a linked schema, and presumably the reason you're creating it is to let people see the audit log.

2022-04-29 17:00 jeckels
Pull Requests»https://github.com/LabKey/platform/pull/3308

2022-05-02 09:29 hannahb
Assigned Totriage»Susan Hert
Priority2»3
Seems like a reasonable approach, thanks Josh. Susan do you mind estimating as the Audit feature owner and assigning back to triage?

2022-05-02 09:33 Susan Hert
Assigned ToSusan Hert»jeckels
Notifyadam;jeckels»adam;jeckels;Susan Hert
Assigning to Josh since there's already a PR attached here.

2022-05-02 09:47 jeckels

2022-05-02 16:34 jeckels
resolve as Fixed
Statusopen»resolved
Assigned Tojeckels»martyp
Now merged to develop.

2022-06-09 16:24 jeckels
Assigned Tomartyp»Sweta Jewargikar
Assigning to Sweta as test feature owner of linked schemas.

2022-07-18 13:07 Sweta Jewargikar
close
Statusresolved»closed
Assigned ToSweta Jewargikar»Guest