Skip to content

Commit

Permalink
use IGroup::getBackendNames() instead of Reflection
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed Oct 11, 2022
1 parent b1bdafb commit 4e5c9aa
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/Jobs/MigrateGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function migrateGroup(string $gid): bool {
$qb = $this->dbc->getQueryBuilder();
$affected = $qb->delete('groups')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
->execute();
->executeStatement();
if ($affected === 0) {
throw new \RuntimeException('Could not delete group from local backend');
}
Expand Down Expand Up @@ -141,14 +141,9 @@ protected function getGroupsToMigrate(array $samlGroups, array $pool): array {
if ($group === null) {
return false;
}
$reflected = new \ReflectionClass($group);
$backendsProperty = $reflected->getProperty('backends');
$backendsProperty->setAccessible(true);
$backends = $backendsProperty->getValue($group);
foreach ($backends as $backend) {
if ($backend instanceof Database) {
return true;
}
$backendNames = $group->getBackendNames();
if (in_array('Database', $backendNames, true)) {
return true;
}
return false;
});
Expand Down

0 comments on commit 4e5c9aa

Please sign in to comment.