Skip to content

Add PROXY_USER context when the "Audit Columns" setting is enabled #79

@kamilrybicki

Description

@kamilrybicki

Copied my idea from APEX ideas app: https://apexapps.oracle.com/pls/apex/r/apex_pm/ideas/details?idea=FR-4566

Idea Summary
Enhance the "Audit Columns" setting in Quick SQL by including the PROXY_USER context from USERENV when setting the created_by and updated_by columns in the generated triggers. Currently, the value is set using:

:new.created_by := coalesce(sys_context('APEX$SESSION','APP_USER'),user);
:new.updated_by := coalesce(sys_context('APEX$SESSION','APP_USER'),user);

This should be extended to also include sys_context('USERENV','PROXY_USER') to better support proxy users.

Use Case
In projects where proxy user is used the actual user performing the action may be available via sys_context('USERENV','PROXY_USER'). The current implementation in Quick SQL ignores this context, resulting in audit columns capturing the database user (USER) or the APEX user, but not the true acting user. This leads to incomplete or misleading audit information.

Preferred Solution
I see two options.

  1. The “Audit Columns” setting should always include code sys_context('USERENV','PROXY_USER') in generated triggers.
  2. A new setting will be added (for example, in the Options section) called "Proxy Users" or something similar. After enabling it, the code sys_context('USERENV','PROXY_USER') will be added to generated triggers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions