0cb24b4759
access.xml: 12 component-specific actions added: - mokosuitecross.crosspost (auto cross-post on publish) - mokosuitecross.crosspost.manual (manually create posts) - mokosuitecross.delete.remote (delete from remote platforms) - mokosuitecross.services.manage (create/edit/delete services) - mokosuitecross.services.credentials (view decrypted credentials) - mokosuitecross.templates.manage (create/edit/delete templates) - mokosuitecross.logs.view (view activity logs) - mokosuitecross.logs.purge (purge old logs) - mokosuitecross.queue.manage (manage post queue) - mokosuitecross.queue.export (export posts as CSV) - mokosuitecross.dispatch (trigger REST API dispatch) - mokosuitecross.migrate (run Perfect Publisher migration) config.xml: permissions fieldset with rules field for admin UI. Enforcement: - DisplayController: core.manage gate on all views - ServicesController: publish/delete ACL checks - TemplatesController: publish/delete ACL checks - PostsController: queue.export permission - ServiceController: services.manage for test connection - DispatchController: dispatch permission for REST API - All list views: preferences button gated by core.admin - All edit views: save/apply buttons gated by section permission - MokoSuiteCrossHelper::getActions() centralizes ACL lookups
66 lines
1.8 KiB
PHP
66 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package MokoSuiteCross
|
|
* @subpackage com_mokosuitecross
|
|
* @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
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
namespace Joomla\Component\MokoSuiteCross\Administrator\View\Service;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\CMS\Language\Text;
|
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
|
use Joomla\CMS\Router\Route;
|
|
use Joomla\CMS\Toolbar\Toolbar;
|
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
|
use Joomla\Component\MokoSuiteCross\Administrator\Helper\MokoSuiteCrossHelper;
|
|
|
|
class HtmlView extends BaseHtmlView
|
|
{
|
|
protected $form;
|
|
protected $item;
|
|
|
|
public function display($tpl = null): void
|
|
{
|
|
$this->form = $this->get('Form');
|
|
$this->item = $this->get('Item');
|
|
|
|
$this->addToolbar();
|
|
|
|
parent::display($tpl);
|
|
}
|
|
|
|
protected function addToolbar(): void
|
|
{
|
|
$isNew = empty($this->item->id);
|
|
$canDo = MokoSuiteCrossHelper::getActions();
|
|
|
|
ToolbarHelper::title(
|
|
'MokoSuiteCross — ' . ($isNew ? Text::_('COM_MOKOSUITECROSS_NEW_SERVICE') : Text::_('COM_MOKOSUITECROSS_EDIT_SERVICE')),
|
|
'share-alt'
|
|
);
|
|
|
|
if ($canDo->get('mokosuitecross.services.manage')) {
|
|
ToolbarHelper::apply('service.apply');
|
|
ToolbarHelper::save('service.save');
|
|
}
|
|
|
|
// Dashboard button in toolbar
|
|
$toolbar = Toolbar::getInstance('toolbar');
|
|
$toolbar->appendButton(
|
|
'Link',
|
|
'home',
|
|
'COM_MOKOSUITECROSS_SUBMENU_DASHBOARD',
|
|
Route::_('index.php?option=com_mokosuitecross&view=dashboard', false)
|
|
);
|
|
|
|
ToolbarHelper::cancel('service.cancel');
|
|
}
|
|
}
|