ADconsole v1.0.0
First public release. - docs: document the audit log, user offboarding, CSV export and the "require a reason for destructive actions" setting across README, docs/ and CLAUDE/AGENTS.md; note retention for panel_audit - docs: fill the publishing placeholders (repo URL, security contact, issue-template links) and add a semantic-versioning policy - move agent/contributor context into CLAUDE/ (AGENTS.md + a README); root CLAUDE.md is now a thin @-import pointer - add a favicon (shield-lock, matching the login screen) to the login page and the app layout - CHANGELOG: promote [Unreleased] to [1.0.0]; keep the earlier internal build as [0.1.0] Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UfuvfwexztdS7LDpGuKsuK
This commit is contained in:
commit
1126d96271
174 files changed
+27113
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\AuditLog;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AuditLogTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_settings_change_is_recorded_with_the_acting_admin(): void
|
||||
{
|
||||
$this->actingAsPanelAdmin()->put('/settings', [
|
||||
'reset_password' => ['must_change_password' => '1', 'unlock_account' => '1'],
|
||||
'password_policy' => ['max_age_days' => '30'],
|
||||
'audit' => ['require_reason' => '1'],
|
||||
])->assertRedirect();
|
||||
|
||||
$entry = AuditLog::query()->where('action', 'config.settings')->latest('id')->first();
|
||||
|
||||
$this->assertNotNull($entry);
|
||||
$this->assertSame('tester', $entry->actor);
|
||||
$this->assertSame(30, $entry->context['max_age_days']);
|
||||
$this->assertTrue($entry->context['require_reason']);
|
||||
}
|
||||
|
||||
public function test_attribute_config_change_is_recorded(): void
|
||||
{
|
||||
$this->actingAsPanelAdmin()->put('/settings/attributes', [
|
||||
'attributes' => [
|
||||
['key' => 'title', 'label' => 'Stanowisko', 'ldap' => 'title', 'category' => 'org', 'type' => 'text', 'column' => '0'],
|
||||
],
|
||||
])->assertRedirect();
|
||||
|
||||
$this->assertDatabaseHas('panel_audit', ['action' => 'config.attributes', 'actor' => 'tester']);
|
||||
}
|
||||
|
||||
public function test_audit_page_renders_and_filters_by_action(): void
|
||||
{
|
||||
AuditLog::create(['actor' => 'alice', 'actor_name' => 'Alice', 'action' => 'user.disable', 'target' => 'jkowalski', 'created_at' => now()]);
|
||||
AuditLog::create(['actor' => 'bob', 'actor_name' => 'Bob', 'action' => 'user.move', 'target' => 'anowak', 'created_at' => now()]);
|
||||
|
||||
$this->actingAsPanelAdmin()->get('/audit')->assertOk()->assertSee('jkowalski')->assertSee('anowak');
|
||||
|
||||
$this->actingAsPanelAdmin()->get('/audit?action=user.disable')
|
||||
->assertOk()
|
||||
->assertSee('jkowalski')
|
||||
->assertDontSee('anowak');
|
||||
}
|
||||
|
||||
public function test_audit_page_requires_authentication(): void
|
||||
{
|
||||
$this->get('/audit')->assertRedirect('/login');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user