1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-19 10:42:29 +03:00

Comment Mentions: Fixed and tweaks during review of changes

- Added advisory on role permission form to advise which allow listing
  of users/roles.
- Updated database config to avoid PHP8.5 deprecation.
- Tweaked migration to remove unused index.
- Fixed test namespace.
This commit is contained in:
Dan Brown
2025-12-18 17:15:29 +00:00
parent 90fc02c57f
commit 51f9b63db0
6 changed files with 19 additions and 8 deletions

View File

@@ -81,7 +81,7 @@ return [
'strict' => false, 'strict' => false,
'engine' => null, 'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([ 'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), (PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [], ]) : [],
], ],

View File

@@ -15,7 +15,7 @@ return new class extends Migration
$table->increments('id'); $table->increments('id');
$table->string('mentionable_type', 50)->index(); $table->string('mentionable_type', 50)->index();
$table->unsignedBigInteger('mentionable_id')->index(); $table->unsignedBigInteger('mentionable_id')->index();
$table->unsignedInteger('from_user_id')->index(); $table->unsignedInteger('from_user_id');
$table->unsignedInteger('to_user_id'); $table->unsignedInteger('to_user_id');
$table->timestamps(); $table->timestamps();
}); });

View File

@@ -197,11 +197,13 @@ return [
'role_import_content' => 'Import content', 'role_import_content' => 'Import content',
'role_editor_change' => 'Change page editor', 'role_editor_change' => 'Change page editor',
'role_notifications' => 'Receive & manage notifications', 'role_notifications' => 'Receive & manage notifications',
'role_permission_note_users_and_roles' => 'These permissions will technically also provide visibility & searching of users & roles in the system.',
'role_asset' => 'Asset Permissions', '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.', '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.', 'role_asset_desc' => 'These permissions control default access to the assets within the system. Permissions on Books, Chapters and Pages will override these permissions.',
'role_asset_admins' => 'Admins are automatically given access to all content but these options may show or hide UI options.', 'role_asset_admins' => 'Admins are automatically given access to all content but these options may show or hide UI options.',
'role_asset_image_view_note' => 'This relates to visibility within the image manager. Actual access of uploaded image files will be dependant upon system image storage option.', 'role_asset_image_view_note' => 'This relates to visibility within the image manager. Actual access of uploaded image files will be dependant upon system image storage option.',
'role_asset_users_note' => 'These permissions will technically also provide visibility & searching of users in the system.',
'role_all' => 'All', 'role_all' => 'All',
'role_own' => 'Own', 'role_own' => 'Own',
'role_controlled_by_asset' => 'Controlled by the asset they are uploaded to', 'role_controlled_by_asset' => 'Controlled by the asset they are uploaded to',

View File

@@ -30,10 +30,10 @@
<label class="setting-list-label">{{ trans('settings.role_system') }}</label> <label class="setting-list-label">{{ trans('settings.role_system') }}</label>
<a href="#" refs="permissions-table@toggle-all" class="text-small text-link">{{ trans('common.toggle_all') }}</a> <a href="#" refs="permissions-table@toggle-all" class="text-small text-link">{{ trans('common.toggle_all') }}</a>
<div class="toggle-switch-list grid half mt-m"> <div class="toggle-switch-list grid half my-m">
<div> <div>
<div>@include('settings.roles.parts.checkbox', ['permission' => 'restrictions-manage-all', 'label' => trans('settings.role_manage_entity_permissions')])</div> <div>@include('settings.roles.parts.checkbox', ['permission' => 'restrictions-manage-all', 'label' => trans('settings.role_manage_entity_permissions')]) <sup>1</sup></div>
<div>@include('settings.roles.parts.checkbox', ['permission' => 'restrictions-manage-own', 'label' => trans('settings.role_manage_own_entity_permissions')])</div> <div>@include('settings.roles.parts.checkbox', ['permission' => 'restrictions-manage-own', 'label' => trans('settings.role_manage_own_entity_permissions')]) <sup>1</sup></div>
<div>@include('settings.roles.parts.checkbox', ['permission' => 'templates-manage', 'label' => trans('settings.role_manage_page_templates')])</div> <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' => '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' => 'content-export', 'label' => trans('settings.role_export_content')])</div>
@@ -48,6 +48,10 @@
<p class="text-warn text-small mt-s mb-none">{{ trans('settings.roles_system_warning') }}</p> <p class="text-warn text-small mt-s mb-none">{{ trans('settings.roles_system_warning') }}</p>
</div> </div>
</div> </div>
<p class="mb-none text-small text-muted">
<sup>1</sup> {{ trans('settings.role_permission_note_users_and_roles') }}
</p>
</div> </div>
<div> <div>
@@ -75,7 +79,7 @@
@include('settings.roles.parts.asset-permissions-row', ['title' => trans('entities.books'), 'permissionPrefix' => 'book']) @include('settings.roles.parts.asset-permissions-row', ['title' => trans('entities.books'), 'permissionPrefix' => 'book'])
@include('settings.roles.parts.asset-permissions-row', ['title' => trans('entities.chapters'), 'permissionPrefix' => 'chapter']) @include('settings.roles.parts.asset-permissions-row', ['title' => trans('entities.chapters'), 'permissionPrefix' => 'chapter'])
@include('settings.roles.parts.asset-permissions-row', ['title' => trans('entities.pages'), 'permissionPrefix' => 'page']) @include('settings.roles.parts.asset-permissions-row', ['title' => trans('entities.pages'), 'permissionPrefix' => 'page'])
@include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.images'), 'permissionPrefix' => 'image', 'refMark' => '1']) @include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.images'), 'permissionPrefix' => 'image'])
@include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.attachments'), 'permissionPrefix' => 'attachment']) @include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.attachments'), 'permissionPrefix' => 'attachment'])
@include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.comments'), 'permissionPrefix' => 'comment']) @include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.comments'), 'permissionPrefix' => 'comment'])
</div> </div>
@@ -83,6 +87,8 @@
<div> <div>
<p class="text-muted text-small p-m"> <p class="text-muted text-small p-m">
<sup>1</sup> {{ trans('settings.role_asset_image_view_note') }} <sup>1</sup> {{ trans('settings.role_asset_image_view_note') }}
<br>
<sup>2</sup> {{ trans('settings.role_asset_users_note') }}
</p> </p>
</div> </div>
</div> </div>

View File

@@ -6,16 +6,19 @@
<div class="flex py-s px-m min-width-xxs"> <div class="flex py-s px-m min-width-xxs">
<small class="hide-over-m bold">{{ trans('common.create') }}<br></small> <small class="hide-over-m bold">{{ trans('common.create') }}<br></small>
@include('settings.roles.parts.checkbox', ['permission' => $permissionPrefix . '-create-all', 'label' => '']) @include('settings.roles.parts.checkbox', ['permission' => $permissionPrefix . '-create-all', 'label' => ''])
@if($permissionPrefix === 'comment')<sup class="text-muted">2</sup>@endif
</div> </div>
<div class="flex py-s px-m min-width-xxs"> <div class="flex py-s px-m min-width-xxs">
<small class="hide-over-m bold">{{ trans('common.view') }}<br></small> <small class="hide-over-m bold">{{ trans('common.view') }}<br></small>
<small class="faded">{{ trans('settings.role_controlled_by_asset') }}@if($refMark ?? false)<sup>{{ $refMark }}</sup>@endif</small> <small class="faded">{{ trans('settings.role_controlled_by_asset') }}@if($permissionPrefix === 'image')<sup class="text-muted">1</sup>@endif</small>
</div> </div>
<div class="flex py-s px-m min-width-xxs"> <div class="flex py-s px-m min-width-xxs">
<small class="hide-over-m bold">{{ trans('common.edit') }}<br></small> <small class="hide-over-m bold">{{ trans('common.edit') }}<br></small>
@include('settings.roles.parts.checkbox', ['permission' => $permissionPrefix . '-update-own', 'label' => trans('settings.role_own')]) @include('settings.roles.parts.checkbox', ['permission' => $permissionPrefix . '-update-own', 'label' => trans('settings.role_own')])
@if($permissionPrefix === 'comment')<sup class="text-muted">2</sup>@endif
<br> <br>
@include('settings.roles.parts.checkbox', ['permission' => $permissionPrefix . '-update-all', 'label' => trans('settings.role_all')]) @include('settings.roles.parts.checkbox', ['permission' => $permissionPrefix . '-update-all', 'label' => trans('settings.role_all')])
@if($permissionPrefix === 'comment')<sup class="text-muted">2</sup>@endif
</div> </div>
<div class="flex py-s px-m min-width-xxs"> <div class="flex py-s px-m min-width-xxs">
<small class="hide-over-m bold">{{ trans('common.delete') }}<br></small> <small class="hide-over-m bold">{{ trans('common.delete') }}<br></small>

View File

@@ -1,6 +1,6 @@
<?php <?php
namespace Activity; namespace Tests\Activity;
use BookStack\Activity\Models\Comment; use BookStack\Activity\Models\Comment;
use Tests\TestCase; use Tests\TestCase;