generated from Nodarx/template
9a767339fe
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
50 lines
1.8 KiB
PHP
50 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KTXM\ServiceWopi;
|
|
|
|
use KTXF\Module\Configuration\ConsoleModuleContextInterface;
|
|
use KTXF\Module\Configuration\BrowserModuleContextInterface;
|
|
use KTXF\Module\Configuration\ModuleContextInterface;
|
|
use KTXF\Module\ModuleInstanceAbstract;
|
|
use KTXM\ServiceWopi\Console\CheckCommand;
|
|
use KTXM\ServiceWopi\Console\CleanupCommand;
|
|
use KTXM\ServiceWopi\Console\ConfigureCommand;
|
|
use KTXC\Resource\ProviderManager;
|
|
use KTXF\Resource\Provider\ProviderInterface;
|
|
use KTXM\ServiceWopi\Preview\Provider;
|
|
|
|
class Module extends ModuleInstanceAbstract
|
|
{
|
|
public function __construct(private readonly ProviderManager $providers) {}
|
|
|
|
public function boot(): void
|
|
{
|
|
$this->providers->register(ProviderInterface::TYPE_PREVIEW, 'wopi', Provider::class);
|
|
}
|
|
|
|
public function handle(): string { return 'service_wopi'; }
|
|
public function label(): string { return 'WOPI Service'; }
|
|
public function author(): string { return 'Ktrix'; }
|
|
public function version(): string { return '0.0.1'; }
|
|
public function description(): string { return 'Read-only WOPI document access and discovery'; }
|
|
|
|
public function permissions(): array
|
|
{
|
|
return ['service_wopi.view' => ['label' => 'View office documents', 'description' => 'Open documents in the configured office server', 'group' => 'Documents']];
|
|
}
|
|
|
|
public function configure(ModuleContextInterface $context): void
|
|
{
|
|
if ($context instanceof BrowserModuleContextInterface) {
|
|
$context->registerModule($this, 'ServiceWopi', 'static/module.mjs');
|
|
}
|
|
if ($context instanceof ConsoleModuleContextInterface) {
|
|
$context->registerCommand(CheckCommand::class);
|
|
$context->registerCommand(CleanupCommand::class);
|
|
$context->registerCommand(ConfigureCommand::class);
|
|
}
|
|
}
|
|
}
|