Add SAML prefix to migration

Signed-off-by: Giuliano Mele <giuliano.mele@verdigado.com>
This commit is contained in:
Giuliano Mele 2021-12-07 18:14:44 +01:00 committed by Jonathan Treffler
parent a40e812512
commit e380b24720

View file

@ -111,8 +111,16 @@ class MigrateGroups extends QueuedJob {
if($affected === 0) {
throw new \RuntimeException('Could not delete group from local backend');
}
if(!$this->ownGroupBackend->createGroup($gid)) {
$samlGid = $gid;
if (strlen($gid) < 6 || substr($gid, 0, 5) !== 'SAML_') {
$samlGid = 'SAML_'.$gid;
$query = $this->dbc->getQueryBuilder();
$query->update(GroupBackend::TABLE_MEMBERS)
->set('gid', $query->createNamedParameter($samlGid))
->where($query->expr()->eq('gid', $query->createNamedParameter($gid)))
->execute();
}
if(!$this->ownGroupBackend->createGroup($samlGid, $gid)) {
throw new \RuntimeException('Could not create group in SAML backend');
}