feat: kill switch de licença Mindtek/Mind Place (marketplace-ready) — 1.5.0
- plugin_init aborta e check_config falha se licença inválida ou Mind Place ausente - README: seção de Licenciamento; CHANGELOG: 1.5.0 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
0eff7d70f7
commit
bb2ef47493
3 changed files with 51 additions and 3 deletions
|
|
@ -4,6 +4,13 @@ Todas as mudanças relevantes deste plugin são documentadas aqui.
|
||||||
O formato segue [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/)
|
O formato segue [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/)
|
||||||
e o versionamento segue [SemVer](https://semver.org/lang/pt-BR/).
|
e o versionamento segue [SemVer](https://semver.org/lang/pt-BR/).
|
||||||
|
|
||||||
|
## [1.5.0]
|
||||||
|
|
||||||
|
### Adicionado
|
||||||
|
- **Kill switch de licença Mindtek / Mind Place** (requisito do marketplace): o plugin
|
||||||
|
só ativa e registra seus hooks se a licença for válida (`\GlpiPlugin\Mindplace\License::isValid()`).
|
||||||
|
Sem Mind Place ou com licença inválida, o plugin é desativado por segurança, sem erros.
|
||||||
|
|
||||||
## [1.4.0]
|
## [1.4.0]
|
||||||
|
|
||||||
### Adicionado
|
### Adicionado
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,13 @@ Contrato de API completo (o que sai do GLPI, como entra no Redmine — endpoints
|
||||||
- Categorias do Redmine são **por projeto**: a categoria padrão é definida no vínculo de cada projeto/entidade.
|
- Categorias do Redmine são **por projeto**: a categoria padrão é definida no vínculo de cada projeto/entidade.
|
||||||
- O vínculo por **Entidade** é **1:1 e por correspondência exata** — não há herança pela árvore de entidades. O chamado precisa nascer na própria entidade vinculada.
|
- O vínculo por **Entidade** é **1:1 e por correspondência exata** — não há herança pela árvore de entidades. O chamado precisa nascer na própria entidade vinculada.
|
||||||
|
|
||||||
|
## Licenciamento
|
||||||
|
|
||||||
|
Este é um plugin proprietário distribuído pelo **Mind Place** (marketplace da Mindtek).
|
||||||
|
Ele exige o plugin **Mind Place** instalado e uma **licença válida**: sem isso, o plugin
|
||||||
|
não ativa (kill switch). A licença é um serial fornecido pela Mindtek e ativado na aba
|
||||||
|
**Configurar → Plugins → Mind Place**.
|
||||||
|
|
||||||
## Suporte
|
## Suporte
|
||||||
|
|
||||||
Mindtek — integração GLPI/Redmine.
|
Mindtek — integração GLPI/Redmine.
|
||||||
|
|
|
||||||
40
setup.php
40
setup.php
|
|
@ -1,6 +1,25 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PLUGIN_REDMINE_VERSION', '1.4.0');
|
define('PLUGIN_REDMINE_VERSION', '1.5.0');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the Mindplace License class if the autoloader has not run yet.
|
||||||
|
* Needed because this plugin may initialize before mindplace.
|
||||||
|
*/
|
||||||
|
function plugin_redmine_load_license() {
|
||||||
|
if (class_exists('\GlpiPlugin\Mindplace\License')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ([
|
||||||
|
GLPI_ROOT . '/plugins/mindplace/src/License.php',
|
||||||
|
GLPI_ROOT . '/marketplace/mindplace/src/License.php',
|
||||||
|
] as $path) {
|
||||||
|
if (file_exists($path)) {
|
||||||
|
include_once $path;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init hooks of the plugin.
|
* Init hooks of the plugin.
|
||||||
|
|
@ -10,6 +29,14 @@ function plugin_init_redmine() {
|
||||||
|
|
||||||
$PLUGIN_HOOKS['csrf_compliant']['redmine'] = true;
|
$PLUGIN_HOOKS['csrf_compliant']['redmine'] = true;
|
||||||
|
|
||||||
|
// ──────────────────────────────────────────────────────────────────
|
||||||
|
// KILL SWITCH — aborta silenciosamente se a licença Mindtek for inválida
|
||||||
|
// ──────────────────────────────────────────────────────────────────
|
||||||
|
plugin_redmine_load_license();
|
||||||
|
if (!class_exists('\GlpiPlugin\Mindplace\License') || !\GlpiPlugin\Mindplace\License::isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Register classes
|
// Register classes
|
||||||
Plugin::registerClass('PluginRedmineConfig', [
|
Plugin::registerClass('PluginRedmineConfig', [
|
||||||
'addtabon' => ['Config']
|
'addtabon' => ['Config']
|
||||||
|
|
@ -78,8 +105,15 @@ function plugin_redmine_check_prerequisites() {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function plugin_redmine_check_config($verbose = false) {
|
function plugin_redmine_check_config($verbose = false) {
|
||||||
if ($verbose) {
|
plugin_redmine_load_license();
|
||||||
echo "Installed / not configured";
|
|
||||||
|
if (!class_exists('\GlpiPlugin\Mindplace\License') || !\GlpiPlugin\Mindplace\License::isValid()) {
|
||||||
|
if ($verbose && !isCommandLine()) {
|
||||||
|
echo "<div class='alert alert-danger'>"
|
||||||
|
. "Licença Mindtek inativa ou Mind Place ausente. O plugin foi desativado por segurança."
|
||||||
|
. "</div>";
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue