dragon-forks/kernel/namespace.php
2025-03-29 10:45:47 +01:00

30 lines
No EOL
915 B
PHP

<?php
/**
* Handle one of the game namespace
*
* The game namespace allow us to compartimentate the game
* into several domain, each with their own level of authentification
* - The "site" domain will be available to non-authentified users
* - The "game" domain will be available to authentified, non-banned users
* - The "user" domain will be available to authentified, non-banned users
* - The "admin" domain will be available to admins
*
* This allow to more simply handle authorisation
*/
class NamespaceHandler {
private $name;
private $authLevel;
public $haveCharacterId;
public function __construct($name, $authLevel, $haveCharacterId) {
$this->name = $name;
$this->authLevel = $authLevel;
$this->haveCharacterId = $haveCharacterId;
}
public function canShow() {
global $authLevel;
return $this->authLevel <= $authLevel;
}
}