From 7071b92a19b2c928c58c4b5bb93957c705b823ad Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 13 Jun 2026 07:09:16 -0500 Subject: [PATCH] feat: add granular ACL permissions via access.xml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add access.xml with standard Joomla core actions (admin, options, manage, create, delete, edit, edit.state) plus three custom actions for backup-specific operations: - mokosuitebackup.backup.run — trigger backup operations - mokosuitebackup.backup.download — download archive files (contains full database and site files) - mokosuitebackup.backup.restore — restore from backup (destructive) Also includes: remaining review fixes for enqueueMessage consistency in ensureSubmenuItems, syncMenuIcons, warnMissingLicenseKey catch blocks, and index.html write check in createBackupDirectory. --- source/packages/com_mokosuitebackup/access.xml | 15 +++++++++++++++ .../language/en-GB/com_mokosuitebackup.ini | 8 ++++++++ .../language/en-GB/com_mokosuitebackup.sys.ini | 8 ++++++++ .../language/en-US/com_mokosuitebackup.ini | 9 +++++++++ .../language/en-US/com_mokosuitebackup.sys.ini | 8 ++++++++ .../com_mokosuitebackup/mokosuitebackup.xml | 2 ++ source/script.php | 18 +++++++++++++++++- 7 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 source/packages/com_mokosuitebackup/access.xml diff --git a/source/packages/com_mokosuitebackup/access.xml b/source/packages/com_mokosuitebackup/access.xml new file mode 100644 index 00000000..c7e6f788 --- /dev/null +++ b/source/packages/com_mokosuitebackup/access.xml @@ -0,0 +1,15 @@ + + +
+ + + + + + + + + + +
+
diff --git a/source/packages/com_mokosuitebackup/language/en-GB/com_mokosuitebackup.ini b/source/packages/com_mokosuitebackup/language/en-GB/com_mokosuitebackup.ini index 7bb6af0c..ac36f20f 100644 --- a/source/packages/com_mokosuitebackup/language/en-GB/com_mokosuitebackup.ini +++ b/source/packages/com_mokosuitebackup/language/en-GB/com_mokosuitebackup.ini @@ -12,6 +12,14 @@ COM_MOKOJOOMBACKUP_SUBMENU_DASHBOARD="Dashboard" COM_MOKOJOOMBACKUP_SUBMENU_BACKUPS="Backup Records" COM_MOKOJOOMBACKUP_SUBMENU_PROFILES="Backup Profiles" +; ACL Actions +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RUN="Run Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RUN_DESC="Allows users in this group to trigger backup operations." +COM_MOKOSUITEBACKUP_ACTION_BACKUP_DOWNLOAD="Download Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_DOWNLOAD_DESC="Allows users in this group to download backup archive files. These archives contain the full database and site files." +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RESTORE="Restore Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RESTORE_DESC="Allows users in this group to restore the site from a backup archive. This is a destructive operation that overwrites the current site." + ; Dashboard view COM_MOKOJOOMBACKUP_DASHBOARD_TITLE="MokoSuiteBackup Dashboard" COM_MOKOJOOMBACKUP_DASHBOARD_LAST_BACKUP="Last Backup" diff --git a/source/packages/com_mokosuitebackup/language/en-GB/com_mokosuitebackup.sys.ini b/source/packages/com_mokosuitebackup/language/en-GB/com_mokosuitebackup.sys.ini index 3776c946..d9887da7 100644 --- a/source/packages/com_mokosuitebackup/language/en-GB/com_mokosuitebackup.sys.ini +++ b/source/packages/com_mokosuitebackup/language/en-GB/com_mokosuitebackup.sys.ini @@ -9,3 +9,11 @@ COM_MOKOJOOMBACKUP_DESCRIPTION="Full-site backup and restore for Joomla — data COM_MOKOJOOMBACKUP_SUBMENU_DASHBOARD="Dashboard" COM_MOKOJOOMBACKUP_SUBMENU_BACKUPS="Backup Records" COM_MOKOJOOMBACKUP_SUBMENU_PROFILES="Backup Profiles" + +; ACL Actions +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RUN="Run Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RUN_DESC="Allows users in this group to trigger backup operations." +COM_MOKOSUITEBACKUP_ACTION_BACKUP_DOWNLOAD="Download Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_DOWNLOAD_DESC="Allows users in this group to download backup archive files. These archives contain the full database and site files." +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RESTORE="Restore Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RESTORE_DESC="Allows users in this group to restore the site from a backup archive. This is a destructive operation that overwrites the current site." diff --git a/source/packages/com_mokosuitebackup/language/en-US/com_mokosuitebackup.ini b/source/packages/com_mokosuitebackup/language/en-US/com_mokosuitebackup.ini index e552cb61..2878f11d 100644 --- a/source/packages/com_mokosuitebackup/language/en-US/com_mokosuitebackup.ini +++ b/source/packages/com_mokosuitebackup/language/en-US/com_mokosuitebackup.ini @@ -9,6 +9,15 @@ COM_MOKOJOOMBACKUP_DESCRIPTION="Full-site backup and restore for Joomla" COM_MOKOJOOMBACKUP_SUBMENU_DASHBOARD="Dashboard" COM_MOKOJOOMBACKUP_SUBMENU_BACKUPS="Backup Records" COM_MOKOJOOMBACKUP_SUBMENU_PROFILES="Backup Profiles" + +; ACL Actions +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RUN="Run Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RUN_DESC="Allows users in this group to trigger backup operations." +COM_MOKOSUITEBACKUP_ACTION_BACKUP_DOWNLOAD="Download Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_DOWNLOAD_DESC="Allows users in this group to download backup archive files. These archives contain the full database and site files." +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RESTORE="Restore Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RESTORE_DESC="Allows users in this group to restore the site from a backup archive. This is a destructive operation that overwrites the current site." + COM_MOKOJOOMBACKUP_DASHBOARD_TITLE="MokoSuiteBackup Dashboard" COM_MOKOJOOMBACKUP_DASHBOARD_LAST_BACKUP="Last Backup" COM_MOKOJOOMBACKUP_DASHBOARD_NO_BACKUPS="No backups yet" diff --git a/source/packages/com_mokosuitebackup/language/en-US/com_mokosuitebackup.sys.ini b/source/packages/com_mokosuitebackup/language/en-US/com_mokosuitebackup.sys.ini index 184d0b25..23f1d10e 100644 --- a/source/packages/com_mokosuitebackup/language/en-US/com_mokosuitebackup.sys.ini +++ b/source/packages/com_mokosuitebackup/language/en-US/com_mokosuitebackup.sys.ini @@ -9,3 +9,11 @@ COM_MOKOJOOMBACKUP_DESCRIPTION="Full-site backup and restore for Joomla — data COM_MOKOJOOMBACKUP_SUBMENU_DASHBOARD="Dashboard" COM_MOKOJOOMBACKUP_SUBMENU_BACKUPS="Backup Records" COM_MOKOJOOMBACKUP_SUBMENU_PROFILES="Backup Profiles" + +; ACL Actions +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RUN="Run Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RUN_DESC="Allows users in this group to trigger backup operations." +COM_MOKOSUITEBACKUP_ACTION_BACKUP_DOWNLOAD="Download Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_DOWNLOAD_DESC="Allows users in this group to download backup archive files. These archives contain the full database and site files." +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RESTORE="Restore Backup" +COM_MOKOSUITEBACKUP_ACTION_BACKUP_RESTORE_DESC="Allows users in this group to restore the site from a backup archive. This is a destructive operation that overwrites the current site." diff --git a/source/packages/com_mokosuitebackup/mokosuitebackup.xml b/source/packages/com_mokosuitebackup/mokosuitebackup.xml index 2b101173..39c77090 100644 --- a/source/packages/com_mokosuitebackup/mokosuitebackup.xml +++ b/source/packages/com_mokosuitebackup/mokosuitebackup.xml @@ -50,6 +50,8 @@ alt="Profiles">COM_MOKOJOOMBACKUP_SUBMENU_PROFILES + access.xml + config.xml cli forms services diff --git a/source/script.php b/source/script.php index bfbbe1cf..9f949dcd 100644 --- a/source/script.php +++ b/source/script.php @@ -231,7 +231,9 @@ class Pkg_MokoSuiteBackupInstallerScript $indexHtml = $backupDir . '/index.html'; if (!file_exists($indexHtml)) { - file_put_contents($indexHtml, ''); + if (file_put_contents($indexHtml, '') === false) { + error_log('MokoSuiteBackup: Failed to write index.html to ' . $backupDir); + } } } @@ -468,6 +470,11 @@ class Pkg_MokoSuiteBackupInstallerScript } } catch (\Exception $e) { error_log('MokoSuiteBackup: ensureSubmenuItems() failed: ' . $e->getMessage()); + Factory::getApplication()->enqueueMessage( + 'MokoSuiteBackup could not create or update sidebar menu items. ' + . 'If submenu entries are missing, try reinstalling the component.', + 'warning' + ); } } @@ -502,6 +509,10 @@ class Pkg_MokoSuiteBackupInstallerScript $db->execute(); } catch (\Exception $e) { error_log('MokoSuiteBackup: syncMenuIcons() failed: ' . $e->getMessage()); + Factory::getApplication()->enqueueMessage( + 'MokoSuiteBackup could not update sidebar menu icons. This is cosmetic and does not affect functionality.', + 'notice' + ); } } @@ -583,6 +594,11 @@ class Pkg_MokoSuiteBackupInstallerScript } catch (\Exception $e) { error_log('MokoSuiteBackup: License key check failed: ' . $e->getMessage()); + Factory::getApplication()->enqueueMessage( + 'MokoSuiteBackup could not verify your license key status. ' + . 'Please check System → Update Sites to ensure a valid license key is configured.', + 'warning' + ); } } }