ff5f0108b9
Generic: Repo Health / Access control (push) Successful in 1s
Generic: Repo Health / Site Health (push) Has been skipped
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Generic: Repo Health / Access control (pull_request) Successful in 1s
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 3s
Universal: Auto Version Bump / Version Bump (push) Successful in 8s
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 6s
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Successful in 6s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 6s
Universal: PR Check / Validate PR (pull_request) Failing after 20s
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.2) (pull_request) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.3) (pull_request) Has been cancelled
Joomla: Extension CI / PHPStan Analysis (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled
Enforce granular permissions defined in access.xml: Controllers (server-side enforcement): - BackupsController: start() → backup.run, download() → backup.download, restore() → backup.restore - AjaxController: init()/step() → backup.run, browseDir()/viewLog() → core.manage - API BackupsController: backup() → backup.run, download() → backup.download, profiles() → core.manage - ProfilesController: importAkeeba() → core.create Views (toolbar button visibility): - Backups: conditionally show Start, Restore, Delete, Preferences - Profiles: conditionally show Add, Edit, Import, Delete, Preferences - Profile edit: conditionally show Save/Apply based on create/edit Templates: - Backups list: hide download button when backup.download denied
75 lines
2.1 KiB
PHP
75 lines
2.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package MokoSuiteBackup
|
|
* @subpackage com_mokosuitebackup
|
|
* @author Moko Consulting <hello@mokoconsulting.tech>
|
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
|
* @license GNU General Public License version 3 or later; see LICENSE
|
|
*/
|
|
|
|
namespace Joomla\Component\MokoSuiteBackup\Administrator\View\Profiles;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\CMS\Language\Text;
|
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
|
use Joomla\Component\MokoSuiteBackup\Administrator\Engine\AkeebaImporter;
|
|
|
|
class HtmlView extends BaseHtmlView
|
|
{
|
|
protected $items;
|
|
protected $pagination;
|
|
protected $state;
|
|
public $filterForm;
|
|
public $activeFilters = [];
|
|
public bool $akeebaDetected = false;
|
|
|
|
public function display($tpl = null): void
|
|
{
|
|
$this->items = $this->get('Items');
|
|
$this->pagination = $this->get('Pagination');
|
|
$this->state = $this->get('State');
|
|
$this->filterForm = $this->get('FilterForm');
|
|
$this->activeFilters = $this->get('ActiveFilters');
|
|
|
|
// Check if Akeeba Backup is installed
|
|
$importer = new AkeebaImporter();
|
|
$detection = $importer->detect();
|
|
$this->akeebaDetected = $detection['profiles'];
|
|
|
|
$this->addToolbar();
|
|
|
|
parent::display($tpl);
|
|
}
|
|
|
|
protected function addToolbar(): void
|
|
{
|
|
$user = Factory::getApplication()->getIdentity();
|
|
|
|
ToolbarHelper::title(Text::_('COM_MOKOJOOMBACKUP_PROFILES_TITLE'), 'cog');
|
|
|
|
if ($user->authorise('core.create', 'com_mokosuitebackup')) {
|
|
ToolbarHelper::addNew('profile.add');
|
|
}
|
|
|
|
if ($user->authorise('core.edit', 'com_mokosuitebackup')) {
|
|
ToolbarHelper::editList('profile.edit');
|
|
}
|
|
|
|
if ($this->akeebaDetected && $user->authorise('core.create', 'com_mokosuitebackup')) {
|
|
ToolbarHelper::custom('profiles.importAkeeba', 'upload', '', 'COM_MOKOJOOMBACKUP_TOOLBAR_IMPORT_AKEEBA', false);
|
|
}
|
|
|
|
if ($user->authorise('core.delete', 'com_mokosuitebackup')) {
|
|
ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'profiles.delete');
|
|
}
|
|
|
|
if ($user->authorise('core.admin', 'com_mokosuitebackup')) {
|
|
ToolbarHelper::preferences('com_mokosuitebackup');
|
|
}
|
|
}
|
|
}
|