19 lines
No EOL
562 B
PHP
19 lines
No EOL
562 B
PHP
<?php
|
|
class Auth {
|
|
// Access Control
|
|
public static function check($project) {
|
|
$baseUrl = Config::get('BASE_URL', '/');
|
|
if (!isset($_SESSION['user_email'])) {
|
|
header('Location: ' . $baseUrl . '?error=2');
|
|
exit();
|
|
}
|
|
if (!isset($_SESSION['user_projects']) || !in_array($project, $_SESSION['user_projects'])) {
|
|
header('Location: ' . $baseUrl);
|
|
exit();
|
|
}
|
|
}
|
|
// User Getter
|
|
public static function user() {
|
|
return $_SESSION['user_email'] ?? null;
|
|
}
|
|
} |