Revert "Append SAML_ prefix to groups"

This reverts commit 48f331ff32.
This commit is contained in:
Giuliano Mele 2021-12-09 11:17:30 +01:00
parent 6741fb6f89
commit a0abb34db2
2 changed files with 4 additions and 17 deletions

View File

@ -50,13 +50,8 @@ class GroupBackend extends ABackend implements IAddToGroupBackend, ICountUsersBa
$groups = [];
while( $row = $cursor->fetch()) {
if (strlen($row['gid']) < 6 || substr($row['gid'], 0, 5) !== 'SAML_') {
$groups[] = 'SAML_' . $row['gid'];
$this->groupCache[$row['gid']] = 'SAML_' . $row['gid'];
} else {
$groups[] = $row['gid'];
$this->groupCache[$row['gid']] = $row['gid'];
}
$groups[] = $row['gid'];
$this->groupCache[$row['gid']] = $row['gid'];
}
$cursor->closeCursor();

View File

@ -111,16 +111,8 @@ class MigrateGroups extends QueuedJob {
if($affected === 0) {
throw new \RuntimeException('Could not delete group from local backend');
}
$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)) {
if(!$this->ownGroupBackend->createGroup($gid)) {
throw new \RuntimeException('Could not create group in SAML backend');
}