Files
MokoSuiteBackup/source/packages/com_mokosuitebackup/src/View/Profile/HtmlView.php
T
Jonathan Miller 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
feat: wire up ACL permission checks across all controllers and views
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
2026-06-13 07:23:57 -05:00

54 lines
1.4 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\Profile;
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;
class HtmlView extends BaseHtmlView
{
protected $item;
protected $form;
public function display($tpl = null): void
{
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->addToolbar();
parent::display($tpl);
}
protected function addToolbar(): void
{
$isNew = empty($this->item->id);
$title = $isNew ? 'COM_MOKOJOOMBACKUP_PROFILE_NEW' : 'COM_MOKOJOOMBACKUP_PROFILE_EDIT';
$user = Factory::getApplication()->getIdentity();
$canSave = $isNew
? $user->authorise('core.create', 'com_mokosuitebackup')
: $user->authorise('core.edit', 'com_mokosuitebackup');
ToolbarHelper::title(Text::_($title), 'cog');
if ($canSave) {
ToolbarHelper::apply('profile.apply');
ToolbarHelper::save('profile.save');
}
ToolbarHelper::cancel('profile.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
}
}