Revert last commits

This reverts commit 2ddef6058d.
This commit is contained in:
2021-10-13 02:57:00 +01:00
parent 2ddef6058d
commit a880eb65b0
13 changed files with 2263 additions and 1916 deletions

93
database/seeders/PermissionSeeder.php Executable file → Normal file
View File

@@ -1,24 +1,4 @@
<?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;
@@ -36,76 +16,71 @@ class PermissionSeeder extends Seeder
{
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
//
$user = Role::create(
[
'name' => 'user',
'name' => 'user'
]
);
$reviewer = Role::create(
[
'name' => 'reviewer',
'name' => 'reviewer'
]
);
$hiringManager = Role::create(
[
'name' => 'hiringManager',
'name' => 'hiringManager'
]
);
$admin = Role::create([
'name' => 'admin',
'name' => 'admin'
]);
// Spatie wildcard permissions (same concept of MC permissions)
$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' => '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.*']);
'profiles.view.others',
'profiles.edit.others',
Permission::create(['name' => 'profiles.view.others']);
Permission::create(['name' => 'profiles.edit.others']);
'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.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']);
foreach ($permissions as $permission)
{
Permission::create(['name' => $permission]);
}
Permission::create(['name' => 'admin.developertools.use']);
$user->givePermissionTo([
'applications.submit',
'applications.view.own',
'profiles.view.others',
'profiles.view.others'
]);
// Able to view applications and vote on them once they reach the right stage, but not approve applications up to said stage
$reviewer->givePermissionTo([
'applications.view.all',
'applications.vote',
'applications.vote'
]);
$hiringManager->givePermissionTo('appointments.*', 'applications.*', 'admin.hiring.*');
@@ -118,7 +93,7 @@ class PermissionSeeder extends Seeder
'admin.notificationsettings.*',
'profiles.view.others',
'profiles.edit.others',
'admin.maintenance.logs.view',
'admin.maintenance.logs.view'
]);
}
}