Files
Phraseanet/lib/classes/patch/4111PHRAS4106.php
jygaulier 7ac7417fc4 PHRAS-4106_ignore-openid-groups (#4561)
* add: setting `usegroups` : set to false to disable groups (even if the provider returns groups)
fix : `birthgroup` can be null
fix : `everyone-group` can be null

* add default setting

* add patch

Co-authored-by: aynsix <asr@esokia-webagency.com>
2024-12-03 14:54:55 +01:00

66 lines
1.4 KiB
PHP

<?php
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class patch_4111PHRAS4106 implements patchInterface
{
/** @var string */
private $release = '4.1.11';
/** @var array */
private $concern = [base::APPLICATION_BOX];
/**
* Returns the release version.
*
* @return string
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
/** @var PropertyAccess $conf */
$conf = $app['conf'];
foreach ($app['conf']->get(['authentication', 'providers'], []) as $providerId => $data) {
if ($data['type'] === "openid") {
if(!isset($data['options']['usegroups'])) {
$data['options']['usegroups'] = false;
$providerConfig[$providerId] = $data;
$conf->merge(['authentication', 'providers'], $providerConfig);
}
}
}
return true;
}
}