Does Servoy have a field-specific audit trailing which can be set at runtime?
I’d like to be able to add/remove audit logging for a specific field in the system during execution time.
just use table events. you can add in your own framework to track what should be logged, and what shouldn’t.
You can set the audit trail config at runtime at startup of your solution using security.setSecuritySettings().
Paul
Hello,
About security.setSecuritySettings(). For auditlog I used to set manually the security settings for every table I want to track. This worked fine, so in the log table I see all the changes made on the certain tables.
Now I want to change this manually settings and use security.setSecuritySettings(). For example I use this code:
var vColNames = new Array();
vColNames[0] = 'uuid';
vColNames[1] = 'flags';
var vDataset = databaseManager.createEmptyDataSet(0, vColNames);
var vArraySecurity = new Array();
vArraySecurity[0] = 'server.table';
vArraySecurity[1] = security.READ|security.INSERT|security.UPDATE|security.DELETE|security.TRACKING|security.VIEWABLE;
vDataset.addRow(vArraySecurity);
security.setSecuritySettings(vDataset);
As you can see, I uesed security.TRACKING instead of JSSecurity.TRACKING because I saw that the second version doesn’t work.
I call the method on startup solution but unfortunately it doesn’t work, there are no new records in log table. Am I missing something?
I use Servoy Version: 5.2.4 - build 1006 and I test in a Debug Client.
ionelioras:
Hello,About security.setSecuritySettings(). For auditlog I used to set manually the security settings for every table I want to track. This worked fine, so in the log table I see all the changes made on the certain tables.
Now I want to change this manually settings and use security.setSecuritySettings(). For example I use this code:var vColNames = new Array();
vColNames[0] = ‘uuid’;
vColNames[1] = ‘flags’;
var vDataset = databaseManager.createEmptyDataSet(0, vColNames);
var vArraySecurity = new Array();
vArraySecurity[0] = ‘server.table’;
vArraySecurity[1] = security.READ|security.INSERT|security.UPDATE|security.DELETE|security.TRACKING|security.VIEWABLE;
vDataset.addRow(vArraySecurity);
security.setSecuritySettings(vDataset);
As you can see, I uesed security.TRACKING instead of JSSecurity.TRACKING because I saw that the second version doesn't work. I call the method on startup solution but unfortunately it doesn't work, there are no new records in log table. Am I missing something? I use Servoy Version: 5.2.4 - build 1006 and I test in a Debug Client.
JSSecurity.TRACKING will work in next release. setSecuritySettings seems to work fine (tried your code in a small example), do you have a sample to illustrate the issue ?
we use tracking like that and it seems to work fine…
ionelioras:
Hello,About security.setSecuritySettings(). For auditlog I used to set manually the security settings for every table I want to track. This worked fine, so in the log table I see all the changes made on the certain tables.
Now I want to change this manually settings and use security.setSecuritySettings(). For example I use this code:var vColNames = new Array();
vColNames[0] = ‘uuid’;
vColNames[1] = ‘flags’;
var vDataset = databaseManager.createEmptyDataSet(0, vColNames);
var vArraySecurity = new Array();
vArraySecurity[0] = ‘server.table’;
vArraySecurity[1] = security.READ|security.INSERT|security.UPDATE|security.DELETE|security.TRACKING|security.VIEWABLE;
vDataset.addRow(vArraySecurity);
security.setSecuritySettings(vDataset);
As you can see, I uesed security.TRACKING instead of JSSecurity.TRACKING because I saw that the second version doesn't work. I call the method on startup solution but unfortunately it doesn't work, there are no new records in log table. Am I missing something? I use Servoy Version: 5.2.4 - build 1006 and I test in a Debug Client.
Thanks everybody for dropping your comments/suggestions. This is helpful.
However, based on your code Servoy’s audit trailing can only be set on per table basis. Can I set it on per table and field basis? I am currently using the dbi file event methods to manually perform this. I just needed to know if Servoy has a built-in feature which we can use.
erikd:
ionelioras:
Hello,About security.setSecuritySettings(). For auditlog I used to set manually the security settings for every table I want to track. This worked fine, so in the log table I see all the changes made on the certain tables.
Now I want to change this manually settings and use security.setSecuritySettings(). For example I use this code:var vColNames = new Array();
vColNames[0] = ‘uuid’;
vColNames[1] = ‘flags’;
var vDataset = databaseManager.createEmptyDataSet(0, vColNames);
var vArraySecurity = new Array();
vArraySecurity[0] = ‘server.table’;
vArraySecurity[1] = security.READ|security.INSERT|security.UPDATE|security.DELETE|security.TRACKING|security.VIEWABLE;
vDataset.addRow(vArraySecurity);
security.setSecuritySettings(vDataset);
As you can see, I uesed security.TRACKING instead of JSSecurity.TRACKING because I saw that the second version doesn't work. I call the method on startup solution but unfortunately it doesn't work, there are no new records in log table. Am I missing something? I use Servoy Version: 5.2.4 - build 1006 and I test in a Debug Client.Thanks everybody for dropping your comments/suggestions. This is helpful.
However, based on your code Servoy’s audit trailing can only be set on per table basis. Can I set it on per table and field basis? I am currently using the dbi file event methods to manually perform this. I just needed to know if Servoy has a built-in feature which we can use.
See the sample in developer for setSecuritySettings. You can put all info in the dataset, tables and/or fields.
It is true, for me works fine also
ionelioras:
It is true, for me works fine also
Let’s say for example, if I have a policy table with policynumber and policydescription field, how do I configure in the dataset to monitor policynumber only and not policydescription field? I tried the following but did not work. It monitors all fields in policy table.
var vColNames = new Array();
vColNames[0] = 'uuid';
vColNames[1] = 'flags';
vColNames[2] = 'field';
var vDataset = databaseManager.createEmptyDataSet(0, vColNames);
var vArraySecurity = new Array();
vArraySecurity[0] = 'databasename.policy';
vArraySecurity[1] = security.READ|security.INSERT|security.UPDATE|security.DELETE|security.TRACKING|security.VIEWABLE;
vArraySecurity[2] = 'policynumber';
vDataset.addRow(vArraySecurity);
security.setSecuritySettings(vDataset);
I also tried the following but did not work. It still monitored all fields in policy table.
var vColNames = new Array();
vColNames[0] = 'uuid';
vColNames[1] = 'flags';
var vDataset = databaseManager.createEmptyDataSet(0, vColNames);
var vArraySecurity = new Array();
vArraySecurity[0] = 'databasename.policy.policynumber';
vArraySecurity[1] = security.READ|security.INSERT|security.UPDATE|security.DELETE|security.TRACKING|security.VIEWABLE;
vDataset.addRow(vArraySecurity);
security.setSecuritySettings(vDataset);
Tracking works only one a per table basis. So there is no tracking for single columns.
patrick:
Tracking works only one a per table basis. So there is no tracking for single columns.
Thanks, Patrick, for making that clear.
If you turn tracing on in the App Server - will it show that the tracking record is added?
I have some simple code to turn on tracking - but it’s not working (NOTE: tracking is in different database connection than main data)
var vColNames = new Array();
var theConn = "dbase1";
vColNames[0] = 'uuid';
vColNames[1] = 'flags';
var vDataset = databaseManager.createEmptyDataSet(0, vColNames);
var vArraySecurity = new Array();
vArraySecurity[0] = theConn + '.memb';
vArraySecurity[1] = security.READ|security.INSERT|security.UPDATE|security.DELETE|security.TRACKING|security.VIEWABLE;
vDataset.addRow(vArraySecurity);
security.setSecuritySettings(vDataset);
Version: 5.2.10 - build 1021
Windows 7 Professional
Java 1.6.0_27
OK - I finally got this to work (but still can’t “see” the log insert when tracing is “ON” in the server).
My problem was: I was accessing a table’s foundset BEFORE I set these commands.
It looks like if you do that - then it’s too bad - it won’t respect the TRACKING.
Hope this helps others who troll across this path in the future…