Skip to content
Snippets Groups Projects
Commit e1ca9757 authored by Jared Hancock's avatar Jared Hancock
Browse files

upgrade: Fix possible crash if a user did not have a group

parent aab5b8a2
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,11 @@ class StaffPermissions extends MigrationTask {
function run($time) {
foreach (Staff::objects() as $staff) {
$role = $staff->getRole()->getPermission();
$role = $staff->getRole();
if ($role)
$role_perms = $role->getPermission();
else
$role_perms = new RolePermission(null);
$perms = array(
User::PERM_CREATE,
User::PERM_EDIT,
......@@ -16,9 +20,9 @@ class StaffPermissions extends MigrationTask {
Organization::PERM_EDIT,
Organization::PERM_DELETE,
);
if ($role->has(FAQ::PERM_MANAGE))
if ($role_perms->has(FAQ::PERM_MANAGE))
$perms[] = FAQ::PERM_MANAGE;
if ($role->has(Email::PERM_BANLIST))
if ($role_perms->has(Email::PERM_BANLIST))
$perms[] = Email::PERM_BANLIST;
$errors = array();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment