Audit Logging

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Audit Logging

Postby christopher.gomes » Fri Jul 28, 2023 6:18 pm

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.
christopher.gomes
 
Posts: 5
Joined: Tue Apr 07, 2020 4:52 pm

Re: Audit Logging

Postby swingman » Sat Jul 29, 2023 9:11 am

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.
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1472
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: Audit Logging

Postby patrick » Sat Jul 29, 2023 3:09 pm

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.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Audit Logging

Postby christopher.gomes » Wed Aug 02, 2023 4:26 pm

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?
christopher.gomes
 
Posts: 5
Joined: Tue Apr 07, 2020 4:52 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: Google [Bot] and 31 guests