Status/features of auditing?


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'm wondering what the current status of auditing is?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Actually, it has already been plumbed into framework and could technically be used...we have just not mentioned it as there are still a few things that need to be done.  You have already seen the auditing files in the DDT, and probably some of the properties on the BO through the designer.  We have not created the auditing viewer yet and so we have not yet "released" it.  But we are using the auditing features already and working through the "issues" and will release all of it probably in the 1.6.7 version.

You can see another post about it here: http://forum.strataframe.net/FindPost16202.aspx

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Cool. I must have missed that post. I check it out some more. BigGrin



Thanks!
Alex Luyando
Alex Luyando
StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 1.2K
Good Morning!



I'm running the latest beta (1.6.7) and am seeing a discrepancy between the help for the Permission Editor and the actual dialog. Specifically, the Help shows a dialog that has Auditing options for Application and Data Events; the actual Permission dialog I am seeing does not.



Should I be seeing the two additional options?



Thanks.




________________
_____/ Regards,
____/ al
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
The auditing features have not been fully implemented (or released).  If you notice, you will actually find the Auditor class within the framework as well as the SFSAuditing tables that get imported when importing the security tables into a DDT project.  However, though the BOs technically support this, we have not fully released this as of yet as we intend to add some additional functionality in the form of a control that allows you to place a viewer for teh audit records on a dialog.  Once this has been completed, then the user-level actions will be enabled.
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I would like to know, how would the auditing feature work in RBS? What would be audited? and etc...



Thank you
Guillermo Vilas
Guillermo Vilas
StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 2.3K
Hi guys,

Can you post a sample that shows the best place to put the Audit logic, I was trying in the AfterSave and AfterDelete events in my Base BO but I can not trap the row changes when deleted. At this moment I'm able to capture the Added and Modifed changes in the row. but if the BO is deleted I can't log it.



Thanks for your help

------------------------------------------------------------------------
I would like to change the world, but they don´t give me the source code.
MS Windows 7 Ultimate 64-Bit
Intel(R) Core(TM)2 Quad CPU Q9300 2.50 GHz
6.00 GB of RAM, NVIDIA GeForce 9800 GT

MacBook Pro i5 OSX Lion
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Guillermo.

Have a look at this post:

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

Guillermo Vilas
Guillermo Vilas
StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 2.3K
Hi Ivan,

The fields that I want to capture are:

- DocumentCode

- TransactionType

- ChangesDescription

- UpdateType

- TableSourceName

- UserCreated

- DateCreated

- UserModified

- DateModified



I´ve created a custom method the retreive Audit data, I´m not using SF Audit methods yet.

I´m currently using the Audit logic at the OnBeforeSave And OnBeforeDelete Events, I´m still having some problems.



1) In the OnBeforeSave Event the Object is not saved so if an error happens how can I stop the Auditing to be captured.

2) As the BO is not yet saved I can´t retrieve the PK generated for this Object.

3) If I put the Audit logic in the OnAfterSave then I do get the PK but can not log Modified BO´s because the state has changed.

4) I can´t Audit deleted BO´s



This are the methods I´m using on the Base BO







Private Sub AuditChanges(ByVal table As DataTable, ByVal transactionType As String, ByVal transactionDescription As String)

If (Not table.GetChanges Is Nothing) Then

Dim num4 As Integer = (table.Rows.Count - 1)

Dim i As Integer = 0

Do While (i <= num4)

Dim loTable As DataTable = table

If loTable.Rows.Item(i).RowState <> DataRowState.Unchanged Then

If (loTable.Rows.Item(i).RowState <> DataRowState.Deleted) Then

loTable.Rows.Item(i).BeginEdit()

If ((loTable.Rows.Item(i).RowState = DataRowState.Detached) OrElse (loTable.Rows.Item(i).RowState = DataRowState.Added)) Then

If (loTable.Columns.Contains("UserCreated")) Then

loTable.Rows.Item(i).Item("UserCreated") = MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser.UserName

End If

If loTable.Columns.Contains("DateCreated") Then

loTable.Rows.Item(i).Item("DateCreated") = DateTime.Now

End If

End If

If loTable.Columns.Contains("UserModified") Then

loTable.Rows.Item(i).Item("UserModified") = MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser.UserName

End If

If loTable.Columns.Contains("DateModified") Then

loTable.Rows.Item(i).Item("DateModified") = DateTime.Now

End If

loTable.Rows.Item(i).EndEdit()

End If

If (table.TableName <> "AuditTrail") Then

Me.CreateAuditTrail(loTable.Rows.Item(i), transactionType, transactionDescription)

End If

loTable = Nothing

End If

i += 1

Loop

End If

End Sub



Private Sub CreateAuditTrail(ByVal rowValue As DataRow, ByVal transactionType As String, ByVal transactionDescription As String)



If Me.EnableAuditTrail Then

Using bo As New AuditTrailBO

bo.NewRow()

Dim current As DataRowVersion = DataRowVersion.Current

Dim builder As New StringBuilder

If (rowValue.RowState = DataRowState.Deleted) Then

current = DataRowVersion.Original

End If

bo.CurrentRow.BeginEdit()

If rowValue.Table.Columns.Contains("Counter") Then

bo.CurrentRow.Item("DocumentID") = System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(rowValue.Item("Counter", current))

End If

Dim num2 As Integer = (rowValue.Table.PrimaryKey.Length - 1)

Dim i As Integer = 0

Do While (i <= num2)

If (i = 0) Then

builder.Append(rowValue.Item(rowValue.Table.PrimaryKey(i).ColumnName, current).ToString)

Else

builder.Append(("," & rowValue.Item(rowValue.Table.PrimaryKey(i).ColumnName, current).ToString))

End If

i += 1

Loop

bo.CurrentRow.Item("AuditTrailGUID") = Guid.NewGuid

bo.CurrentRow.Item("DocumentCode") = builder.ToString

bo.CurrentRow.Item("TransactionType") = transactionType



If String.IsNullOrEmpty(transactionDescription) Then

bo.CurrentRow.Item("TransactionDescription") = GetCurrentDescription(rowValue, True)

Else

bo.CurrentRow.Item("TransactionDescription") = transactionDescription

End If

bo.CurrentRow.Item("UpdateAction") = rowValue.RowState.ToString

bo.CurrentRow.Item("TableSourceName") = rowValue.Table.TableName

bo.CurrentRow.Item("UserCreated") = MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser.UserName

bo.CurrentRow.Item("DateCreated") = DateTime.Now

bo.CurrentRow.Item("UserModified") = MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser.UserName

bo.CurrentRow.Item("DateModified") = DateTime.Now

bo.CurrentRow.EndEdit()

bo.Save()

End Using

End If

End Sub



Private Function GetCurrentDescription(ByVal row As DataRow, ByVal formatVertical As Boolean) As String

Dim builder As New StringBuilder

Dim column As DataColumn

For Each column In row.Table.Columns

If (row.RowState = DataRowState.Deleted) Then

If formatVertical Then

builder.AppendLine(String.Concat(New String() {"[-]", "", column.ColumnName, ": ", row.Item(column, DataRowVersion.Original).ToString}))

Else

builder.Append(String.Concat(New String() {"[-]", " ", column.ColumnName, ": ", row.Item(column, DataRowVersion.Original).ToString, ChrW(9)}))

End If

Continue For

End If

If (row.RowState = DataRowState.Added) Then

If formatVertical Then

builder.AppendLine(String.Concat(New String() {"[+]", " ", column.ColumnName, ": ", row.Item(column, DataRowVersion.Current).ToString}))

Else

builder.Append(String.Concat(New String() {"[+]", " ", column.ColumnName, ": ", row.Item(column, DataRowVersion.Current).ToString, ChrW(9)}))

End If

Continue For

End If

If ((row.RowState = DataRowState.Modified) Or (row.RowState = DataRowState.Unchanged)) Then

If Not row.Item(column, DataRowVersion.Original).ToString.Equals(row.Item(column, DataRowVersion.Current).ToString) Then

If formatVertical Then

builder.AppendLine(String.Concat(New String() {"[*]", " ", column.ColumnName, ": ", row.Item(column, DataRowVersion.Original).ToString, " -> ", row.Item(column, DataRowVersion.Current).ToString}))

Else

builder.Append(String.Concat(New String() {"[*]", " ", column.ColumnName, ": ", row.Item(column, DataRowVersion.Original).ToString, " -> ", row.Item(column, DataRowVersion.Current).ToString, ChrW(9)}))

End If

Continue For

End If

If formatVertical Then

builder.AppendLine((column.ColumnName & ": " & row.Item(column, DataRowVersion.Original).ToString))

Else

builder.Append((column.ColumnName & ": " & row.Item(column, DataRowVersion.Original).ToString & ChrW(9)))

End If

End If

Next

Return builder.ToString

End Function



Protected Overrides Sub OnBeforeSave(ByVal e As MicroFour.StrataFrame.Data.BeforeSaveUndoEventArgs)

MyBase.OnBeforeSave(e)



If Me.AuditDataChanges Then

If (Not e.Cancel) Then

Me.AuditChanges(Me.CurrentDataTable, Me.TableName, "")

End If

End If



End Sub



Protected Overrides Sub OnBeforeDelete(ByVal e As MicroFour.StrataFrame.Business.BeforeDeleteEventArgs)

MyBase.OnBeforeDelete(e)



If Me.AuditDataChanges Then

If (Not e.Cancel) Then

Me.AuditChanges(Me.CurrentDataTable, Me.TableName, "")

End If

End If



End Sub







I´ll keep searching the forum for SF Audit implementations


------------------------------------------------------------------------
I would like to change the world, but they don´t give me the source code.
MS Windows 7 Ultimate 64-Bit
Intel(R) Core(TM)2 Quad CPU Q9300 2.50 GHz
6.00 GB of RAM, NVIDIA GeForce 9800 GT

MacBook Pro i5 OSX Lion
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Here is a suggestion.  First of all, any auditing logic that you are going to implement should be added to you BaseBO that all of your BOs inherit from.  The SF field level auditing hasn't been fully implemented or released due to the fact that implementing all field level auditing at the BO level isn't always going to be the best way to handle things.

The code that you have here is going to become noticably slower and slower the larger the table or rows that have to be auditing.  You will notice a performance hit if you are going to attempt to do this with every field.  I noticed that you had a set number of fields that you wanted to audit, and here is one suggestion.  If you are going to support a single database type, then creating triggers to handle the auditing may be a better way to go since this will all be done through UPDATEs, INSERTs, and DELETEs on the server side with no additional BO side programming logic...and it should be faster as well since all of the data is already server side.  You don't want to go crazy there either as you don't want to impact performance.  But you would probably have less impact there versus in the BO since the BO would require another trip to the server to save the audit records.

We will release field level auditing in the future, but fore now, this is the major argument why it has not been fully released.  It is relatively easy to add auditing yourself and you can optimize it more for your applicaiton.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search