User country mapping; ignore unused groups #443 (#584)

* Fix the user country import #443

* Ignore the old "core" groups because they're unused #443

* Properly sync roles and individual permissions #443
This commit is contained in:
Nabeel S
2020-02-24 15:12:36 -05:00
committed by GitHub
parent 342fe31ceb
commit 11bbcd1df7
4 changed files with 48 additions and 15 deletions

View File

@@ -70,6 +70,7 @@ class UserImport extends BaseImporter
'rank_id' => $rank_id,
'home_airport_id' => $row->hub,
'curr_airport_id' => $row->hub,
'country' => $row->location,
'flights' => (int) $row->totalflights,
'flight_time' => Time::hoursToMinutes($row->totalhours),
'state' => $state,
@@ -99,7 +100,6 @@ class UserImport extends BaseImporter
{
// Be default add them to the user role, and then determine if they
// belong to any other groups, and add them to that
$roleMappings = [];
$newRoles = [];
// Figure out what other groups they belong to... read from the old table, and map
@@ -108,12 +108,11 @@ class UserImport extends BaseImporter
foreach ($old_user_groups as $oldGroup) {
$newRoleId = $this->idMapper->getMapping('group', $oldGroup->groupid);
// Only lookup a new role ID if found
// if (!in_array($newRoleId, $roleMappings)) {
// $roleMappings[$newRoleId] = Role::where(['id' => $newRoleId])->first();
// }
// This role should be ignored
if ($newRoleId === -1) {
continue;
}
// $newRoles[] = $roleMappings[$newRoleId];
$newRoles[] = $newRoleId;
}