WIP: Road to 1.0.0 #1

Draft
miguel456 wants to merge 123 commits from develop into master
2 changed files with 68 additions and 60 deletions
Showing only changes of commit 0c667d74ef - Show all commits

View File

@ -36,7 +36,7 @@ class PermissionSeeder extends Seeder
{
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
//
$user = Role::create(
[
'name' => 'user',
@ -61,34 +61,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

@ -23,6 +23,7 @@ namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
class TeamSeeder extends Seeder
{
@ -33,42 +34,43 @@ class TeamSeeder extends Seeder
*/
public function run()
{
Permission::create([
'name' => 'teams.user.view.own',
]);
$teamUserPermissions = [
'teams.files.view',
'teams.files.upload',
'teams.files.download',
'teams.files.delete',
];
// Some of these perms also check whether the user is a member or owner to determine access to resources.
$teamPermissions = [
'teams.view',
'teams.create',
'teams.update',
'teams.invite'
];
$admin = Role::where('name', 'admin')->first();
$reviewer = Role::where('name', 'reviewer')->first();
foreach($teamPermissions as $permission)
{
foreach ($teamUserPermissions as $userPermission)
{
Permission::create(['name' => $permission]);
Permission::create(['name' => $userPermission]);
}
}
$admin->givePermissionTo($teamPermissions);
$reviewer->givePermissionTo($teamUserPermissions);
Permission::create([
'name' => 'teams.admin.view.all',
]);
// Has access to the teams feature
Permission::create([
'name' => 'teams.view',
]);
Permission::create([
'name' => 'teams.admin.create',
]);
Permission::create([
'name' => 'teams.admin.delete',
]);
Permission::create([
'name' => 'teams.user.join',
]);
Permission::create([
'name' => 'teams.user.leave',
]);
Permission::create([
'name' => 'teams.admin.vacancies.assign',
]);
Permission::create([
'name' => 'teams.admin.vacancies.unassign',
]);
Permission::create([
'name' => 'teams.admin.applications.changeteam',
]);
Permission::create([
'name' => 'teams.members.groupchat',
]);
}
}