Skip to content

Commit

Permalink
add patch
Browse files Browse the repository at this point in the history
  • Loading branch information
aynsix committed Nov 28, 2024
1 parent 469c889 commit 534df1d
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/configuration.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ authentication:
realm-name: phrasea
exclusive: false
icon-uri: null
usegroups: true
usegroups: false
birth-group: _firstlog
everyone-group: _everyone
metamodel: _metamodel
Expand Down
2 changes: 1 addition & 1 deletion lib/Alchemy/Phrasea/Authentication/Provider/Openid.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public function onCallback(Request $request)
$userName = $data['email'];// login to be an email
}

$usegroups = isset($this->config['usegroups']) ? $this->config['usegroups'] : true;
$usegroups = isset($this->config['usegroups']) ? $this->config['usegroups'] : false;
$userUA = $this->CreateUser([
'id' => $distantUserId = $data['sub'],
'login' => $userName,
Expand Down
65 changes: 65 additions & 0 deletions lib/classes/patch/4111PHRAS4106.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?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;
}
}
2 changes: 1 addition & 1 deletion lib/conf.d/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ authentication:
realm-name: phrasea
exclusive: false
icon-uri: null
usegroups: true
usegroups: false
birth-group: _firstlog
everyone-group: _everyone
metamodel: _metamodel
Expand Down

0 comments on commit 534df1d

Please sign in to comment.