From e8e38f1f7bcc7190a2fc8298f114cd0443ee55f5 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 17 Apr 2022 14:33:06 +0100 Subject: [PATCH] Added an 'editor-change' role permission --- ...1741_add_editor_change_role_permission.php | 40 +++++++++++++++++++ resources/lang/en/settings.php | 1 + .../views/settings/roles/parts/form.blade.php | 1 + 3 files changed, 42 insertions(+) create mode 100644 database/migrations/2022_04_17_101741_add_editor_change_role_permission.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 index 000000000..a9f7f8378 --- /dev/null +++ b/database/migrations/2022_04_17_101741_add_editor_change_role_permission.php @@ -0,0 +1,40 @@ +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(); + } +} diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php index d5bf87ba8..af2dcc1e1 100755 --- a/resources/lang/en/settings.php +++ b/resources/lang/en/settings.php @@ -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.', diff --git a/resources/views/settings/roles/parts/form.blade.php b/resources/views/settings/roles/parts/form.blade.php index a15117e5e..aeaa39a6d 100644 --- a/resources/views/settings/roles/parts/form.blade.php +++ b/resources/views/settings/roles/parts/form.blade.php @@ -37,6 +37,7 @@
@include('settings.roles.parts.checkbox', ['permission' => 'templates-manage', 'label' => trans('settings.role_manage_page_templates')])
@include('settings.roles.parts.checkbox', ['permission' => 'access-api', 'label' => trans('settings.role_access_api')])
@include('settings.roles.parts.checkbox', ['permission' => 'content-export', 'label' => trans('settings.role_export_content')])
+
@include('settings.roles.parts.checkbox', ['permission' => 'editor-change', 'label' => trans('settings.role_editor_change')])
@include('settings.roles.parts.checkbox', ['permission' => 'settings-manage', 'label' => trans('settings.role_manage_settings')])