PHP Class bedezign\yii2\audit\Audit

This module is also responsible for starting the audit process. To configure it you need to do 2 things: - add a module configuration entry: 'modules' => [ 'audit' => 'bedezign\yii2\audit\Audit', ] or optionally with configuration: 'modules' => [ 'audit' => [ 'class' => 'bedezign\yii2\audit\Audit', 'ignoreActions' => ['debug/*'] ] - If you want to auto track actions, be sure to add the module to the application bootstrapping: 'bootstrap' => ['audit'],
Inheritance: extends yii\base\Module
ファイルを表示 Open project: bedezign/yii2-audit Class Usage Examples

Public Properties

Property Type Description
$accessIps IP address or list of IP addresses with access to the viewer, null for everyone (if the IP matches) An IP address can contain the wildcard * at the end so that it matches IP addresses with the same prefix. For example, '192.168.*' matches all IP addresses in the segment '192.168.'.
$accessRoles Role or list of roles with access to the viewer, null for everyone (if the user matches)
$accessUsers User ID or list of user IDs with access to the viewer, null for everyone (if the role matches)
$batchSave The module does batch saving of the data records by default. You can disable this if you are experiencing max_allowed_packet errors when logging huge data quantities. Records will be saved per piece instead of all at once
$compressData Compress extra data generated or just keep in text? For people who don't like binary data in the DB
$db name of the component to use for database access
$ignoreActions Action or list of actions to ignore. '*' is allowed as the first or last character to use as wildcard (eg 'debug/*').
$layout the layout that should be applied for views within this module. This refers to a view name relative to [[layoutPath]]. If this is not set, it means the layout value of the [[module|parent module]] will be taken. If this is false, layout will be disabled within this module.
$logTarget bedezign\yii2\audit\LogTarget
$maxAge Maximum age (in days) of the audit entries before they are truncated
$panels list of panels that should be active/tracking/available during the auditing phase. If the value is a simple string, it is the identifier of an internal panel to activate (with default settings) If the entry is a '' => '|' it is either a new panel or a panel override (if you specify a core id). It is important that the key is unique, as this is the identifier used to store any data associated with the panel. Please note: - If you just want to change the configuration for a core panel, use the $panelConfiguration, it will be merged into this one - If you add custom panels, please namespace them ("mynamespace/panelname").
$panelsMerge This gives you an easy way to just add or modify panels/configurations without having to re-specify every panel. This only accepts regular definitions ('' => ''), but the core class will be added if needed Take a look at the module configuration for more information.
$traceLine
$trackActions Action or list of actions to track. '*' is allowed as the first or last character to use as wildcard.
$userFilterCallback Will be called to translate text in the user filter into a (or more) user id's
$userIdentifierCallback The callback to use to convert a user id into an identifier (username, email, ...). Can also be html.

Public Methods

Method Description
__call ( string $name, array $params ) : mixed
findModuleIdentifier ( ) : integer | null | string
findPanelIdentifier ( string $className ) : boolean | string
getDb ( ) : Connection
getEntry ( boolean $create = false, boolean $new = false ) : AuditEntry | static
getPanel ( string $identifier ) : null | bedezign\yii2\audit\components\panels\Panel
getPanelIdentifiers ( ) : string[] Returns a list of all available panel identifiers
getUserIdentifier ( $user_id ) : string
init ( )
loadPanels ( $list ) : bedezign\yii2\audit\components\panels\Panel[] Tries to assemble the configuration for the panels that the user wants for auditing
onAfterRequest ( )
onBeforeAction ( ActionEvent $event ) Called to evaluate if the current request should be logged
registerFunction ( string $name, callable $callback ) Allows panels to register functions that can be called directly on the module
registerPanel ( Panel $panel )

Protected Methods

Method Description
normalizePanelConfiguration ( ) Make sure the configured panels array is a uniform set of => entries.
routeMatches ( string $route, string[] $list ) : boolean Verifies a route against a given list and returns whether it matches or not.

Method Details

__call() public method

public __call ( string $name, array $params ) : mixed
$name string
$params array
return mixed

findModuleIdentifier() public static method

public static findModuleIdentifier ( ) : integer | null | string
return integer | null | string

findPanelIdentifier() public static method

public static findPanelIdentifier ( string $className ) : boolean | string
$className string
return boolean | string

getDb() public method

public getDb ( ) : Connection
return yii\db\Connection the database connection.

getEntry() public method

public getEntry ( boolean $create = false, boolean $new = false ) : AuditEntry | static
$create boolean
$new boolean
return bedezign\yii2\audit\models\AuditEntry | static

getPanel() public method

public getPanel ( string $identifier ) : null | bedezign\yii2\audit\components\panels\Panel
$identifier string
return null | bedezign\yii2\audit\components\panels\Panel

getPanelIdentifiers() public method

Returns a list of all available panel identifiers
public getPanelIdentifiers ( ) : string[]
return string[]

getUserIdentifier() public method

public getUserIdentifier ( $user_id ) : string
$user_id
return string

init() public method

public init ( )

loadPanels() public method

Tries to assemble the configuration for the panels that the user wants for auditing
public loadPanels ( $list ) : bedezign\yii2\audit\components\panels\Panel[]
return bedezign\yii2\audit\components\panels\Panel[]

normalizePanelConfiguration() protected method

Make sure the configured panels array is a uniform set of => entries.

onAfterRequest() public method

public onAfterRequest ( )

onBeforeAction() public method

Called to evaluate if the current request should be logged
public onBeforeAction ( ActionEvent $event )
$event yii\base\ActionEvent

registerFunction() public method

Allows panels to register functions that can be called directly on the module
public registerFunction ( string $name, callable $callback )
$name string
$callback callable

registerPanel() public method

public registerPanel ( Panel $panel )
$panel yii\debug\Panel

routeMatches() protected method

Entries in the list are allowed to end with a '*', which means that a substring will be used for the match instead of a full compare.
protected routeMatches ( string $route, string[] $list ) : boolean
$route string An application rout
$list string[] List of routes to compare against.
return boolean

Property Details

$accessIps public_oe property

IP address or list of IP addresses with access to the viewer, null for everyone (if the IP matches) An IP address can contain the wildcard * at the end so that it matches IP addresses with the same prefix. For example, '192.168.*' matches all IP addresses in the segment '192.168.'.
public $accessIps

$accessRoles public_oe property

Role or list of roles with access to the viewer, null for everyone (if the user matches)
public $accessRoles

$accessUsers public_oe property

User ID or list of user IDs with access to the viewer, null for everyone (if the role matches)
public $accessUsers

$batchSave public_oe property

The module does batch saving of the data records by default. You can disable this if you are experiencing max_allowed_packet errors when logging huge data quantities. Records will be saved per piece instead of all at once
public $batchSave

$compressData public_oe property

Compress extra data generated or just keep in text? For people who don't like binary data in the DB
public $compressData

$db public_oe property

name of the component to use for database access
public $db

$ignoreActions public_oe property

Action or list of actions to ignore. '*' is allowed as the first or last character to use as wildcard (eg 'debug/*').
public $ignoreActions

$layout public_oe property

the layout that should be applied for views within this module. This refers to a view name relative to [[layoutPath]]. If this is not set, it means the layout value of the [[module|parent module]] will be taken. If this is false, layout will be disabled within this module.
public $layout

$logTarget public_oe property

public LogTarget,bedezign\yii2\audit $logTarget
return bedezign\yii2\audit\LogTarget

$maxAge public_oe property

Maximum age (in days) of the audit entries before they are truncated
public $maxAge

$panels public_oe property

list of panels that should be active/tracking/available during the auditing phase. If the value is a simple string, it is the identifier of an internal panel to activate (with default settings) If the entry is a '' => '|' it is either a new panel or a panel override (if you specify a core id). It is important that the key is unique, as this is the identifier used to store any data associated with the panel. Please note: - If you just want to change the configuration for a core panel, use the $panelConfiguration, it will be merged into this one - If you add custom panels, please namespace them ("mynamespace/panelname").
public $panels

$panelsMerge public_oe property

This gives you an easy way to just add or modify panels/configurations without having to re-specify every panel. This only accepts regular definitions ('' => ''), but the core class will be added if needed Take a look at the module configuration for more information.
public $panelsMerge

$traceLine public_oe property

See also: yii\debug\Module::$traceLine
public $traceLine

$trackActions public_oe property

Action or list of actions to track. '*' is allowed as the first or last character to use as wildcard.
public $trackActions

$userFilterCallback public_oe property

Will be called to translate text in the user filter into a (or more) user id's
public $userFilterCallback

$userIdentifierCallback public_oe property

The callback to use to convert a user id into an identifier (username, email, ...). Can also be html.
public $userIdentifierCallback