Hi Michał,
You might need this: https://developer.webcon.com/2023/resources/db/ to start.
I've searched for privilegese, and it seems like WFSecurities and WFConfigurationSecurities is a base of what you need, then joining it with processes/workflows/forms will to the rest.
Sample diagram in attachment.
SELECT *
FROM WFSecurities
WHERE SEC_DEFID = {DEF_ID} -- Process ID
This will give you permissions on process level
SELECT DTYPE_Name, WF_Name, ASS_ID
FROM DocTypeAssocciations
JOIN WFDocTypes ON DTYPE_ID = ASS_DTYPEID
JOIN WorkFlows ON WF_ID = ASS_WFID
WHERE ASS_WFID = {WF_ID} -- Workflow ID
This will give you ASS_ID which is needed to check permissions per workflow/form level
And query to get permission for workflow/form level is following:
SELECT *
FROM WFSecurities
WHERE SEC_ASSID = 267 {ASS_ID} -- association ID
Application level seems to be here:
SELECT *
FROM WFConfigurationSecurities
WHERE CSC_APPID = {APP_ID} -- application ID
I've checked those on my env. and they do print what is in the configuration, although i might have missed something.
Hopefully this will be some nice starting point :)