StrataFrame Forum

Audit

http://forum.strataframe.net/Topic29073.aspx

By Marcio Valerio Silva - 11/23/2010

I set true the BO propertie "AuditDataChanges" but anythig is recording in my BD, what do I have to record this Audit Changes?

Does it should record the BO changes in the Audit SF tables? What am i doing wrong?
By Aaron Young - 11/23/2010

I am not sure auditing is officially supported yet. From memory, I think you can get something working but you also need to enable auditing within the security system in addition to the business objects (SecurityBasics.AllowAuditDataChanges = true, BO.NeverAuditDataChanges = false, BO.AuditDataChanges = true).

It has been a while since I looked at auditing so I can't remember what SF does out of the box. However, you can implement your own auditing based on the way SF does it. In any event, you may want to build you own user interface and it isn't as big a job as it may appear.

Aaron
By Greg McGuffey - 11/23/2010

Aaron is correct. The auditing currently in the framework was not completed and based on a ton of work done since then, it likely will change significantly, as the current method isn't very efficient. It can be used, and if you want to go down that path we can help you along the way. I'll have to double-check, but I believe you'd need to at minimum do the following:
  • deploy auditing tables. I think these are related to security tables and may be deployed already if you are using RBS.
  • configure BO in mapper
  • configure security
  • configure BO properties
  • build UI to access audit history
Let us know if you want to give it a whirl. However, you may just want to see what everyone else is using, so you have some options.

I'll add that I've typically used a SQL server solution (both triggers and sprocs), but haven't been real happy with it. It works fine and is fast and does the job, but it is hard to maintain. SQL Server 2008 has some new features that could ease that significantly.
 
By Marcio Valerio Silva - 11/23/2010

Hello Greg,

There are a thing that I didn´t understand.



When I set the properties in BO object in a form to true how above. What should it happens?

Should it add some information in SF Audit tables or no? If no What I have to do to add this SF audit information?

Sorry, but I don´t write English very well, Im a Brazilian user.  

Please Help-me.
By Aaron Young - 11/24/2010

Hi Marcio,

Setting the business object to enable auditing is not enough as there are 4 separate checks before auditing is enabled and 3 of the checks have to pass.

If you have the SF source code installed, take a look at the Auditor.vb file within the folder:-

\Program Files\MicroFour\StrataFrame Source Code\MicroFour StrataFrame Business\Security

This contains a function that is called to check if auditing is enabled and it is copied below just in case you don't have the source code:-

        ''' <summary>
        ''' Determines whether the data changes to the specified business object should take place.
        ''' The NeverAuditDataChanges and AuditDataChanges properties of the business object are checked
        ''' as well as the AuditDataChanges property of the current user.
        ''' </summary>
        ''' <param name="bo"></param>
        ''' <remarks></remarks>
        Public Shared Function ShouldAuditDataChanges(ByVal bo As BusinessLayer) As Boolean
            '-- If auditing is not enabled globally, then don't audit it
            If Not SecurityBasics.AllowAuditDataChanges Then Return False

            '-- If the business object is set to never, then don't audit
            If bo.NeverAuditDataChanges Then Return False

            '-- If the user is set to audit, then audit
            If SecurityBasics.CurrentUser.AuditDataChanges Then Return True

            '-- Otherwise, just use the setting from the business object
            Return bo.AuditDataChanges
        End Function

The function first checks if auditing is enabled at all which is why you need to ensure you have set "SecurityBasics.AllowAuditDataChanges = true" or else you will fail at the first check. I believe this defaults to false so I suspect you are not getting beyond this step.

To summarise the steps:-

1. Is auditing enabled within the security system? The answer must be yes.

2. Is the business object never audited? The answer cannot be yes.

3. Is the user audited? The answer can be yes in which case auditing is enabled and the next check is not run.

4. Is the business object audited? This check is only run if the user is not set to audit. If the business object is set for auditing then you have passed the test.

The first two checks are compulsory and you must pass both. Then either 3 or 4 must pass.

Hope this helps.
By Marcio Valerio Silva - 11/24/2010

Hi Aaron,

Im tryng the StrataFrame, so I don´t have code sources yet.

So, I only can use the Audit after buy a licence. Am I right?

when I have the source code I back to develop the audit.

Thanks for your help.
By Greg McGuffey - 11/24/2010

Auditing will work without you having the source code. Aaron was just indicating what conditions were necessary for the data in a BO to be audited, which he figured out by looking directly at the source code...one of the advantages of getting a license! BigGrin
By Ivan George Borges - 11/24/2010

Hi Marcio.

Here are some links that will get you started on Auditing. Have a look at them all and get back here for more help.

http://forum.strataframe.net/FindPost21552.aspx

http://forum.strataframe.net/FindPost21836.aspx

http://forum.strataframe.net/FindPost16202.aspx

http://forum.strataframe.net/FindPost12173.aspx

http://forum.strataframe.net/FindPost25664.aspx
By Marcio Valerio Silva - 12/1/2010

Sorry, I already buy the source code but the audit isn´t work yet.

I don´t Understand How to do. If  does somebody has a example or a portuguese tutorial please send-me.

thank you
By Ivan George Borges - 12/1/2010

Hi Marcio.

Have you gone through the posts I listed to you? They will give you a broad idea of how to accomplish Auditing at this stage. Feel free to ask any specific question once you get started.

Regarding the source code, there is no need of it to insert auditing into your application, you have the SF classe for that and you will hook some code at places where you will be able to add events to the Auditing table, which is part of the Security tables that you will deploy into your application's database, using the DDT preferable.