Connection audit
The audit connection to the existing system will be reviewed by example.
Task
Add listening of created and deleted objects in the existing system. Also need to change auditing for a class Кредит
class Diagram
configuration audit
database setup
First we need to configure the audit database. In the form settings properties stage.
Database auditing can be stored in a separate database and database application. This is determined by the setting БД audit database приложения
. If you decide to keep the data together. Select this setting and configure Не remove existing таблицы
.
Save the settings and close the form.
setting the stage
Open the settings form the stage and go to the tab Настройка аудита
-
Click
Включить audit in all классах
(more) -
Save the settings and close the form
set up the classes
Audit creation and deletion is enabled by default. Therefore, to complete the task, you need to enable auditing of changes to class Кредит
.
Odrt class properties Кредит
and install Вести audit operations изменения
.
Save the settings and close the form.
setup a class with the stereotype Application
Generation applications
To generate the application, you must:
- Align database applications
- Generate classes
- Compile classes
- Generate ASP.NET app
Result
The project has added web pages to display audit:
In each data class (class with the stereotype Implementation) added class AuditSettings to store audit settings for this class.
In addition, classes were added to the submission for audit AuditView
, and 4 new fields: Creator
, CreateTime
, Editor
, EditTime
- the consequences of placing the settings to Add audit fields (more).
Viewing operations audit
As mentioned above, the project appeared web page to view audit data. By default, the configuration file responsible for these pages (the file is in the folder forms\audit shown in the figure above), as follows:
<authorization>
<deny users="?"/>
<allow roles="admin" />
<deny users="*" />
</authorization>
This means that access is closed to all users except users with the admin role (read more on MSDN)
To deal with system configuration authority, you must change the configuration file as follows:
<authorization>
<deny users="?"/>
</authorization>
Thus, access to these pages would only be prohibited to unauthorized users.
Links to the page AuditEntityL.aspx
can be put on the Desk or simply type in the address bar the page address.
On the form you can see the standard WebObjectListView is empty, as audited operations have not yet been committed.
Next, you can create a new Клиента
, edit an existing Кредит
, and then update the form display the audit data:
As you can see, time is fixed and the type операции; the object on which the operation was performed (its primaryKey); by whom and where the operation was performed, and the result of the operation.