The PHP app runs on Cafe24 shared web hosting -- calling it 'cloud' was misleading. Renames the directory, the edge client module, and every doc/script/identifier that used the term. - cloud/ -> server/ (incl. server/deploy/build_cafe24_package.sh paths) - edge/cloudclient.py -> edge/serverclient.py, CloudClient -> ServerClient - cloud/docs/cloud-deploy.md -> server/docs/server-deploy.md - CLOUD_* env/config keys -> SERVER_* - tests renamed to match Tests: PHP 109 pass (4 skipped), pytest 167 pass. dist/ regenerated.
28 lines
1 KiB
PHP
28 lines
1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace App\Tests;
|
|
use App\Auth\Rbac;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class RbacTest extends TestCase
|
|
{
|
|
public function testViewerCanOnlyView(): void {
|
|
$this->assertTrue(Rbac::can('viewer', 'view_events'));
|
|
$this->assertFalse(Rbac::can('viewer', 'acknowledge'));
|
|
$this->assertFalse(Rbac::can('viewer', 'edit_zones'));
|
|
}
|
|
public function testOperator(): void {
|
|
$this->assertTrue(Rbac::can('operator', 'acknowledge'));
|
|
$this->assertTrue(Rbac::can('operator', 'edit_zones'));
|
|
$this->assertFalse(Rbac::can('operator', 'manage_thresholds'));
|
|
}
|
|
public function testAdminAll(): void {
|
|
foreach (['view_events','acknowledge','edit_zones','manage_thresholds','manage_compliance'] as $p) {
|
|
$this->assertTrue(Rbac::can('admin', $p));
|
|
}
|
|
}
|
|
public function testUnknownDenied(): void {
|
|
$this->assertFalse(Rbac::can('ghost', 'view_events'));
|
|
$this->assertFalse(Rbac::can('admin', 'unknown_perm'));
|
|
}
|
|
}
|