Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'ignoreActions' => ['audit/*', 'debug/*'] #256

Closed
neoacevedo opened this issue Jan 10, 2019 · 8 comments
Closed

'ignoreActions' => ['audit/*', 'debug/*'] #256

neoacevedo opened this issue Jan 10, 2019 · 8 comments

Comments

@neoacevedo
Copy link

Shouldn't 'ignoreActions' => ['audit/*', 'debug/*'] avoid write into audit_data table these routes?
Plus, related to #138 with 'ignoreActions' => ['*'], all is recorded in audit_entry table so ignoreActions still is buggy.

@Blizzke
Copy link
Member

Blizzke commented Jan 10, 2019

The way things are implemented, *as entry won't work for either situation, it was never meant to as that makes little sense.
Do you have an example of a situation where either */part or part/* doesn't do what it's supposed to?

@neoacevedo
Copy link
Author

'ignoreActions' => ['audit/*', 'debug/*', '*/index'],:

screenshot_20190110_135453

@Blizzke
Copy link
Member

Blizzke commented Jan 13, 2019

It's weird. I ran it on a test project with just the ignoreActions defined like you specified them, and it's nicely ignoring the site/index views (that's what I tested), as it should. Is there something else configured or do you something with the $uniqueId of Yii's ActionEvent?

@neoacevedo
Copy link
Author

It's a clear yii2 app, although good, I'm using the advanced app and I have set this in backend's config for RBAC:

'as access' => [
    'class' => backend\filters\AccessControl::class,
    'allowActions' => ['site/login', 'site/logout', 'site/error', 'debug', 'gii']
]

@borraz
Copy link

borraz commented Apr 2, 2019

I have a similar problem:

'ignoreActions' => ['audit/*', 'debug/*', 'certificate/*'],

image

When the request_method is not GET the ignoreActions dont work as expected.

@marty-macfly
Copy link

marty-macfly commented Oct 23, 2019

Hello,

I've reproduce the same issue and it seems to be related to the error handler \bedezign\yii2\audit\components\web\ErrorHandler creating the audit entry and not the Audit->onBeforeAction method that use the ignoreActions filter.

If I'm disabling error handler I don't have the audit entry anymore. Here is the stack trace I can see:

/app/vendor/lbn/yii2-config/src/db/mysql/Command.php:25
/app/vendor/lbn/yii2-config/src/db/mysql/Command.php:60
/app/vendor/bedezign/yii2-audit/src/models/AuditEntry.php:166
/app/vendor/bedezign/yii2-audit/src/models/AuditEntry.php:55
/app/vendor/bedezign/yii2-audit/src/Audit.php:321
/app/vendor/bedezign/yii2-audit/src/components/base/ErrorHandlerTrait.php:38

@Blizzke
Copy link
Member

Blizzke commented Nov 1, 2019

Okay, got it.
Errors by default are always logged as it is assumed that that is exactly the information you want.
I can however see that you might not want specific entries so I'll see if I can add a second set of tracking-filters for error specifically.

@Blizzke
Copy link
Member

Blizzke commented Nov 1, 2019

1.1.2 has 2 new variables: $trackErrorActions and $ignoreErrorActions. They work the same as the regular ones but for errors. Please note that due to how Yii works (logException functionality) there's no consistent ActionEvent instance to verify (to obtain the route). To get around that, the error handler uses Yii::$app->requestedRoute

@Blizzke Blizzke closed this as completed Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants