]> BookStack Code Mirror - bookstack/commitdiff
Added an 'editor-change' role permission
authorDan Brown <redacted>
Sun, 17 Apr 2022 13:33:06 +0000 (14:33 +0100)
committerDan Brown <redacted>
Sun, 17 Apr 2022 13:33:06 +0000 (14:33 +0100)
database/migrations/2022_04_17_101741_add_editor_change_role_permission.php [new file with mode: 0644]
resources/lang/en/settings.php
resources/views/settings/roles/parts/form.blade.php

diff --git a/database/migrations/2022_04_17_101741_add_editor_change_role_permission.php b/database/migrations/2022_04_17_101741_add_editor_change_role_permission.php
new file mode 100644 (file)
index 0000000..a9f7f83
--- /dev/null
@@ -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();
+    }
+}
index d5bf87ba80612cbc2fae04fdb7259e18f26a6147..af2dcc1e1655bab7208832cb6e090a578f2e931f 100755 (executable)
@@ -152,6 +152,7 @@ return [
     'role_access_api' => 'Access system API',
     'role_manage_settings' => 'Manage app settings',
     'role_export_content' => 'Export content',
+    'role_editor_change' => 'Change page editor',
     'role_asset' => 'Asset Permissions',
     'roles_system_warning' => 'Be aware that access to any of the above three permissions can allow a user to alter their own privileges or the privileges of others in the system. Only assign roles with these permissions to trusted users.',
     'role_asset_desc' => 'These permissions control default access to the assets within the system. Permissions on Books, Chapters and Pages will override these permissions.',
index a15117e5e8df0336ddb2d6eb658117a86d9c2bb3..aeaa39a6da7b5ea8cdfa574cd3e1899d98e823a8 100644 (file)
@@ -37,6 +37,7 @@
                 <div>@include('settings.roles.parts.checkbox', ['permission' => 'templates-manage', 'label' => trans('settings.role_manage_page_templates')])</div>
                 <div>@include('settings.roles.parts.checkbox', ['permission' => 'access-api', 'label' => trans('settings.role_access_api')])</div>
                 <div>@include('settings.roles.parts.checkbox', ['permission' => 'content-export', 'label' => trans('settings.role_export_content')])</div>
+                <div>@include('settings.roles.parts.checkbox', ['permission' => 'editor-change', 'label' => trans('settings.role_editor_change')])</div>
             </div>
             <div>
                 <div>@include('settings.roles.parts.checkbox', ['permission' => 'settings-manage', 'label' => trans('settings.role_manage_settings')])</div>