Fix broken code

This commit is contained in:
2021-10-13 04:07:16 +01:00
parent a880eb65b0
commit 1aee4c053f
9 changed files with 221 additions and 50 deletions

View File

@@ -36,5 +36,6 @@ class DatabaseSeeder extends Seeder
$this->call(\Database\Seeders\UserSeeder::class);
$this->call(\Database\Seeders\DefaultOptionsSeeder::class);
$this->call(\Database\Seeders\NewPermissions::class);
$this->call(\Database\Seeders\TeamSeeder::class);
}
}

View File

@@ -1,4 +1,25 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Database\Seeders;
use App\Facades\Options;
@@ -13,16 +34,27 @@ class DefaultOptionsSeeder extends Seeder
*/
public function run()
{
Options::setOption('notify_new_application_email', true, 'Notify when a new application comes through'); // done
Options::setOption('notify_application_comment', false, 'Notify when someone comments on an application'); // done
Options::setOption('notify_new_user', true, 'Notify when someone signs up'); // done
Options::setOption('notify_application_status_change', true, 'Notify when an application changes status'); // done
Options::setOption('notify_applicant_approved', true, 'Notify when an applicant is approved'); // done
Options::setOption('notify_vacancystatus_change', false, 'Notify when a vacancy\'s status changes'); // done
Options::setOption('notify_new_application_email', true, 'Notify when a new application comes through', 'notifications'); // done
Options::setOption('notify_application_comment', false, 'Notify when someone comments on an application', 'notifications'); // done
Options::setOption('notify_new_user', true, 'Notify when someone signs up', 'notifications'); // done
Options::setOption('notify_application_status_change', true, 'Notify when an application changes status', 'notifications'); // done
Options::setOption('notify_applicant_approved', true, 'Notify when an applicant is approved', 'notifications'); // done
Options::setOption('notify_vacancystatus_change', false, 'Notify when a vacancy\'s status changes', 'notifications'); // done
Options::setOption('enable_slack_notifications', true, 'Enable slack notifications');
Options::setOption('enable_email_notifications', true, 'Enable e-mail notifications');
// added in 0.6.2
Options::setOption('pw_security_policy', 'low', 'Describes the current password security policy.', 'app_security');
Options::setOption('graceperiod', 7, '2FA Grace Period', 'app_security');
Options::setOption('password_expiry', '0', 'Defines wether passwords must be reset after $value', 'app_security');
Options::setOption('force2fa', false, 'Defines whether 2fa is forced upon users', 'app_security');
Options::setOption('force2faRole', 'reviewer', 'Defines which role to force 2fa for', 'app_security');
Options::setOption('requireGameLicense', true, 'Defines whether people need to validate their game license', 'app_security');
Options::setOption('currentGame', 'MINECRAFT', 'Defines what game we\'re working with', 'app_integration');
Options::setOption('enable_slack_notifications', true, 'Enable slack notifications', 'notifications');
Options::setOption('enable_email_notifications', true, 'Enable e-mail notifications', 'notifications');
}
}

View File

@@ -1,4 +1,23 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Database\Seeders;
use Illuminate\Database\Seeder;

View File

@@ -1,4 +1,23 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Database\Seeders;
use Illuminate\Database\Seeder;
@@ -41,35 +60,40 @@ class PermissionSeeder extends Seeder
// Spatie wildcard permissions (same concept of MC permissions)
Permission::create(['name' => 'applications.submit']);
Permission::create(['name' => 'applications.stages.deny']);
Permission::create(['name' => 'applications.stages.approve']);
Permission::create(['name' => 'applications.view.all']);
Permission::create(['name' => 'applications.view.own']);
Permission::create(['name' => 'applications.vote']);
Permission::create(['name' => 'appointments.schedule']);
Permission::create(['name' => 'appointments.schedule.edit']);
Permission::create(['name' => 'appointments.schedule.cancel']);
Permission::create(['name' => 'applications.*']);
Permission::create(['name' => 'appointments.*']);
$permissions = [
'applications.submit',
'applications.stages.deny',
'applications.stages.approve',
'applications.view.all',
'applications.view.own',
'applications.vote',
'appointments.schedule',
'appointments.schedule.edit',
'appointments.schedule.cancel',
'applications.*',
'appointments.*',
Permission::create(['name' => 'profiles.view.others']);
Permission::create(['name' => 'profiles.edit.others']);
'profiles.view.others',
'profiles.edit.others',
Permission::create(['name' => 'admin.userlist']);
Permission::create(['name' => 'admin.stafflist']);
Permission::create(['name' => 'admin.hiring.forms']);
Permission::create(['name' => 'admin.hiring.formbuilder']);
Permission::create(['name' => 'admin.hiring.vacancy']);
Permission::create(['name' => 'admin.hiring.vacancy.edit,delete']);
Permission::create(['name' => 'admin.notificationsettings']);
Permission::create(['name' => 'admin.notificationsettings.edit']);
Permission::create(['name' => 'admin.hiring.*']);
Permission::create(['name' => 'admin.notificationsettings.*']);
Permission::create(['name' => 'admin.maintenance.logs.view']);
'admin.userlist',
'admin.stafflist',
'admin.hiring.forms',
'admin.hiring.formbuilder',
'admin.hiring.vacancy',
'admin.hiring.vacancy.edit,delete',
'admin.notificationsettings',
'admin.notificationsettings.edit',
'admin.hiring.*',
'admin.notificationsettings.*',
'admin.maintenance.logs.view',
'admin.developertools.use',
];
Permission::create(['name' => 'admin.developertools.use']);
foreach ($permissions as $permission)
{
Permission::create(['name' => $permission]);
}
$user->givePermissionTo([
'applications.submit',

View File

@@ -1,4 +1,23 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Database\Seeders;
use App\Profile;
@@ -15,6 +34,17 @@ class UserSeeder extends Seeder
*/
public function run()
{
$ghostAccount = User::create([
'uuid' => 'b741345057274a519144881927be0290', // Ghost
'name' => 'Ghost (deleted account)',
'email' => 'blackhole@example.com',
'email_verified_at' => now(),
'username' => 'ghost',
'originalIP' => '0.0.0.0',
'password' => 'locked'
])->assignRole('user'); // There can't be role-less users
$staffUsers = [
[