v2.6.0: Content backup/git versioning, plugin type system, docs update
New features: - ContentBackup class with ZIP backup/restore and git versioning - Admin backup & restore page (content-backup.twig) with git init/commit/log/restore - Plugin type system: system (blue) vs content (green) with visual badges - PluginAPIInterface + AdminPluginAPI for plugin architecture - Essential plugin flag (cannot edit/deactivate/delete) Improvements: - Consolidated enabled_plugins config (removed plugins.enabled) - Removed Analytics/Logging toggles from admin config page - Fixed Dashboard plugin Twig comments rendered as text - Updated 20 guide files (NL+EN): configuratie, plugins, plugin-development, core-classes, theme-json, layouts, scss-styling, admin-beheerder, nieuw-thema, architectuur - Improved accessibility test script (grep -E, min/max checks) Cleanup: - Removed unused classes: ARIAComponents, AccessibilityManager, ContentSecurityPolicy, etc. - Removed vendor packages: mustache/mustache, php-mqtt/client - Removed old templates: logs.twig, statistics.twig (now plugins) - Moved language files to language/ directory Tests: - Pentest: 30/30 passed, 0 vulnerabilities - WCAG 2.1 AA: 25/25 passed, 100% compliance
This commit is contained in:
+39
-6
@@ -16,7 +16,7 @@ class AdminAuth
|
||||
*/
|
||||
public const ROLE_PERMISSIONS = [
|
||||
'admin' => ['*'],
|
||||
'content-manager' => ['dashboard', 'content', 'content-edit', 'content-new', 'content-delete', 'content-dir-create', 'content-dir-rename', 'content-dir-delete', 'content-move', 'guide', 'logout'],
|
||||
'content-manager' => ['dashboard', 'content', 'content-edit', 'content-new', 'content-delete', 'content-dir-create', 'content-dir-rename', 'content-dir-delete', 'content-move', 'content-backup', 'content-restore', 'content-git-init', 'content-git-commit', 'content-git-restore', 'guide', 'logout'],
|
||||
'bi-manager' => ['dashboard', 'statistics', 'logs', 'guide', 'logout'],
|
||||
'site-admin' => ['dashboard', 'theme', 'theme-new', 'plugins', 'plugins-new', 'plugins-edit', 'plugins-config', 'plugins-toggle', 'plugins-delete', 'statistics', 'logs', 'update', 'guide', 'logout'],
|
||||
];
|
||||
@@ -28,7 +28,7 @@ class AdminAuth
|
||||
'admin' => 'Admin',
|
||||
'content-manager' => 'Content Beheerder',
|
||||
'bi-manager' => 'BI Beheerder',
|
||||
'site-admin' => ' Site Admin',
|
||||
'site-admin' => 'Site Admin',
|
||||
];
|
||||
|
||||
public function __construct(array $appConfig)
|
||||
@@ -170,10 +170,19 @@ class AdminAuth
|
||||
if (!$this->isAuthenticated()) {
|
||||
return null;
|
||||
}
|
||||
return [
|
||||
'username' => $_SESSION['admin_user'],
|
||||
$username = $_SESSION['admin_user'];
|
||||
$userData = [
|
||||
'username' => $username,
|
||||
'role' => $_SESSION['admin_role'] ?? 'admin'
|
||||
];
|
||||
// Enrich with profile fields from admin.json
|
||||
$userEntry = $this->findUser($username);
|
||||
if ($userEntry) {
|
||||
$userData['email'] = $userEntry['email'] ?? '';
|
||||
$userData['author_name'] = $userEntry['author_name'] ?? '';
|
||||
$userData['author_email'] = $userEntry['author_email'] ?? '';
|
||||
}
|
||||
return $userData;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,13 +253,16 @@ class AdminAuth
|
||||
'username' => $u['username'],
|
||||
'role' => $role,
|
||||
'role_label' => self::getRoleLabel($role),
|
||||
'created' => $u['created'] ?? ''
|
||||
'created' => $u['created'] ?? '',
|
||||
'email' => $u['email'] ?? '',
|
||||
'author_name' => $u['author_name'] ?? '',
|
||||
'author_email' => $u['author_email'] ?? '',
|
||||
];
|
||||
}
|
||||
return $users;
|
||||
}
|
||||
|
||||
public function addUser(string $username, string $password, string $role = 'admin'): array
|
||||
public function addUser(string $username, string $password, string $role = 'admin', string $email = '', string $authorName = '', string $authorEmail = ''): array
|
||||
{
|
||||
if ($this->findUser($username)) {
|
||||
return ['success' => false, 'message' => 'Gebruiker bestaat al.'];
|
||||
@@ -266,6 +278,9 @@ class AdminAuth
|
||||
'username' => $username,
|
||||
'password_hash' => password_hash($password, PASSWORD_DEFAULT),
|
||||
'role' => $role,
|
||||
'email' => $email,
|
||||
'author_name' => $authorName,
|
||||
'author_email' => $authorEmail,
|
||||
'created' => date('Y-m-d')
|
||||
];
|
||||
$this->saveAdminConfig();
|
||||
@@ -273,6 +288,24 @@ class AdminAuth
|
||||
return ['success' => true, 'message' => 'Gebruiker aangemaakt.'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the profile (email, author_name, author_email) of a user.
|
||||
*/
|
||||
public function updateUserProfile(string $username, string $email = '', string $authorName = '', string $authorEmail = ''): array
|
||||
{
|
||||
foreach ($this->adminConfig['users'] as &$userEntry) {
|
||||
if ($userEntry['username'] === $username) {
|
||||
$userEntry['email'] = $email;
|
||||
$userEntry['author_name'] = $authorName;
|
||||
$userEntry['author_email'] = $authorEmail;
|
||||
$this->saveAdminConfig();
|
||||
$this->log('info', "Profiel bijgewerkt: {$username}");
|
||||
return ['success' => true, 'message' => 'Profiel opgeslagen.'];
|
||||
}
|
||||
}
|
||||
return ['success' => false, 'message' => 'Gebruiker niet gevonden.'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the role of an existing user.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user