File upload deletion complete & added extension handling

Also fixed issue with file editing on JS side
This commit is contained in:
Dan Brown
2016-10-23 13:36:45 +01:00
parent 867fc8be64
commit 7ee695d74a
6 changed files with 26 additions and 7 deletions

View File

@ -17,6 +17,7 @@ class CreateFilesTable extends Migration
$table->increments('id');
$table->string('name');
$table->string('path');
$table->string('extension', 20);
$table->integer('uploaded_to');
$table->boolean('external');
@ -59,16 +60,12 @@ class CreateFilesTable extends Migration
{
Schema::dropIfExists('files');
// Get roles with permissions we need to change
$adminRoleId = DB::table('roles')->where('system_name', '=', 'admin')->first()->id;
// Create & attach new entity permissions
$ops = ['Create All', 'Create Own', 'Update All', 'Update Own', 'Delete All', 'Delete Own'];
$entity = 'File';
foreach ($ops as $op) {
$permName = strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op));
$permission = DB::table('role_permissions')->where('name', '=', $permName)->get();
DB::table('permission_role')->where('permission_id', '=', $permission->id)->delete();
DB::table('role_permissions')->where('name', '=', $permName)->delete();
}
}
}