Audit module: audit log and address bans
This commit is contained in:
1 parent
b75403e5ea
commit
d2ea1bacac
41 files changed
+2137
-5
No files matched your search
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Auth\Events\Failed;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use IriksIT\Manager\Facades\Manager;
|
||||
use IriksIT\Manager\Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
it('has no audit log, bans, tables or rights unless the site switched it on', function () {
|
||||
expect(Route::has('manager.audit.index'))->toBeFalse()
|
||||
->and(Schema::hasTable('manager_audit_logs'))->toBeFalse()
|
||||
->and(Schema::hasTable('manager_ip_bans'))->toBeFalse()
|
||||
->and(Manager::permissionValues())->not->toContain('audit.view', 'audit.manage');
|
||||
|
||||
// A failed login goes by without a trace, and without a table to write to.
|
||||
event(new Failed('web', null, ['email' => '[email protected]']));
|
||||
});
|
||||
|
||||
it('does not schedule the prune command when the audit log is off', function () {
|
||||
$commands = collect(app(Schedule::class)->events())->map(fn ($event) => $event->command)->implode(' ');
|
||||
|
||||
expect($commands)->not->toContain('manager:audit-prune');
|
||||
});
|
||||
Reference in new issue
Block a user