Page 1 of 1

Audit Logging

PostPosted: Fri Jul 28, 2023 6:18 pm
by christopher.gomes
Has anyone managed to get the logging working?
I've toggled on the log server, created the log table and toggled on the table settings for Tracking(insert/update/delete) for the groups but nothing is being entered into the table.

Re: Audit Logging

PostPosted: Sat Jul 29, 2023 9:11 am
by swingman
Yes, it works. I have it working with the NG clients, Servoy 2020 / 2021 / 2022 and had it working when using Servoy 8.x Smart Client.

Re: Audit Logging

PostPosted: Sat Jul 29, 2023 3:09 pm
by patrick
If you say "for the groups": the concept is that security settings are applied on groups and users as well. So if you have a security group for which tracking on some tables is set, you also need to make sure that your user is logged in with that group.
Typically, that is done in the call

Code: Select all
security.login(username, a_userUID, groups)


That "groups" parameter must include your "tracking group".

Another way of enforcing tracking for tables is in code (vs. in developer). For that you can use

Code: Select all
security.setSecuritySettings(dataset)


Have a look at https://docs.servoy.com/reference/servo ... gs-dataset

There is a short example

Code: Select all
row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method


That means, table "orders" of database connection "example_data" can be read, inserted, updated, deleted and will be tracked. Obviously, more tables could be added to the array like this.

I hope this helps to sort it out.

Re: Audit Logging

PostPosted: Wed Aug 02, 2023 4:26 pm
by christopher.gomes
That second part helped a lot thank you!
When doing the tracking via code, do you still need to enable tracking on the groups or does it just enable tracking for every user?