mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-05 18:04:33 +08:00
Added an 'editor-change' role permission
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AddEditorChangeRolePermission extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$adminRoleId = DB::table('roles')->where('system_name', '=', 'admin')->first()->id;
|
||||
|
||||
$permissionId = DB::table('role_permissions')->insertGetId([
|
||||
'name' => 'editor-change',
|
||||
'display_name' => 'Change page editor',
|
||||
'created_at' => Carbon::now()->toDateTimeString(),
|
||||
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||
]);
|
||||
|
||||
DB::table('permission_role')->insert([
|
||||
'role_id' => $adminRoleId,
|
||||
'permission_id' => $permissionId,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::table('role_permissions')->where('name', '=', 'editor-change')->delete();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user