diff --git a/resources/js/components/entity-permissions-editor.js b/resources/js/components/entity-permissions-editor.js deleted file mode 100644 index a821792a0..000000000 --- a/resources/js/components/entity-permissions-editor.js +++ /dev/null @@ -1,20 +0,0 @@ - -class EntityPermissionsEditor { - - constructor(elem) { - this.permissionsTable = elem.querySelector('[permissions-table]'); - - // Handle toggle all event - this.restrictedCheckbox = elem.querySelector('[name=restricted]'); - this.restrictedCheckbox.addEventListener('change', this.updateTableVisibility.bind(this)); - } - - updateTableVisibility() { - this.permissionsTable.style.display = - this.restrictedCheckbox.checked - ? null - : 'none'; - } -} - -export default EntityPermissionsEditor; \ No newline at end of file diff --git a/resources/js/components/index.js b/resources/js/components/index.js index f360e2b0c..4b17dc403 100644 --- a/resources/js/components/index.js +++ b/resources/js/components/index.js @@ -18,7 +18,6 @@ import dropdown from "./dropdown.js" import dropdownSearch from "./dropdown-search.js" import dropzone from "./dropzone.js" import editorToolbox from "./editor-toolbox.js" -import entityPermissionsEditor from "./entity-permissions-editor.js" import entitySearch from "./entity-search.js" import entitySelector from "./entity-selector.js" import entitySelectorPopup from "./entity-selector-popup.js" @@ -75,7 +74,6 @@ const componentMapping = { "dropdown-search": dropdownSearch, "dropzone": dropzone, "editor-toolbox": editorToolbox, - "entity-permissions-editor": entityPermissionsEditor, "entity-search": entitySearch, "entity-selector": entitySelector, "entity-selector-popup": entitySelectorPopup, diff --git a/resources/js/components/permissions-table.js b/resources/js/components/permissions-table.js index baad75258..df3c055ca 100644 --- a/resources/js/components/permissions-table.js +++ b/resources/js/components/permissions-table.js @@ -1,22 +1,21 @@ class PermissionsTable { - constructor(elem) { - this.container = elem; + setup() { + this.container = this.$el; // Handle toggle all event - const toggleAll = elem.querySelector('[permissions-table-toggle-all]'); - toggleAll.addEventListener('click', this.toggleAllClick.bind(this)); + for (const toggleAllElem of (this.$manyRefs.toggleAll || [])) { + toggleAllElem.addEventListener('click', this.toggleAllClick.bind(this)); + } // Handle toggle row event - const toggleRowElems = elem.querySelectorAll('[permissions-table-toggle-all-in-row]'); - for (let toggleRowElem of toggleRowElems) { + for (const toggleRowElem of (this.$manyRefs.toggleRow || [])) { toggleRowElem.addEventListener('click', this.toggleRowClick.bind(this)); } // Handle toggle column event - const toggleColumnElems = elem.querySelectorAll('[permissions-table-toggle-all-in-column]'); - for (let toggleColElem of toggleColumnElems) { + for (const toggleColElem of (this.$manyRefs.toggleColumn || [])) { toggleColElem.addEventListener('click', this.toggleColumnClick.bind(this)); } } diff --git a/resources/lang/en/entities.php b/resources/lang/en/entities.php index 1720801d2..28ec591d7 100644 --- a/resources/lang/en/entities.php +++ b/resources/lang/en/entities.php @@ -43,7 +43,6 @@ return [ // Permissions and restrictions 'permissions' => 'Permissions', 'permissions_intro' => 'Once enabled, These permissions will take priority over any set role permissions.', - 'permissions_enable' => 'Enable Custom Permissions', 'permissions_save' => 'Save Permissions', 'permissions_owner' => 'Owner', diff --git a/resources/views/form/entity-permissions-row.blade.php b/resources/views/form/entity-permissions-row.blade.php index 023aa36d2..bff7315a0 100644 --- a/resources/views/form/entity-permissions-row.blade.php +++ b/resources/views/form/entity-permissions-row.blade.php @@ -1,4 +1,4 @@ -
+
@icon('role') @@ -6,7 +6,7 @@ {{ $role->display_name }}
@@ -14,7 +14,7 @@ @include('form.restriction-checkbox', ['name'=>'restrictions', 'label' => trans('common.view'), 'action' => 'view'])
- @if(!$model->isA('page')) + @if(!$model instanceof \BookStack\Entities\Models\Page) @include('form.restriction-checkbox', ['name'=>'restrictions', 'label' => trans('common.create'), 'action' => 'create']) @endif
diff --git a/resources/views/form/entity-permissions.blade.php b/resources/views/form/entity-permissions.blade.php index 18df0bb69..321e2f06c 100644 --- a/resources/views/form/entity-permissions.blade.php +++ b/resources/views/form/entity-permissions.blade.php @@ -1,16 +1,10 @@ -
+ {!! csrf_field() !!}

{{ trans('entities.permissions_intro') }}

-
- @include('form.checkbox', [ - 'name' => 'restricted', - 'label' => trans('entities.permissions_enable'), - ]) -
@@ -24,7 +18,6 @@

{{ trans('entities.shelves_permissions_cascade_warning') }}

@endif -
@foreach(\BookStack\Auth\Role::restrictable() as $role) @include('form.entity-permissions-row', ['role' => $role, 'model' => $model]) diff --git a/resources/views/settings/roles/parts/form.blade.php b/resources/views/settings/roles/parts/form.blade.php index 593791997..044b4ceb4 100644 --- a/resources/views/settings/roles/parts/form.blade.php +++ b/resources/views/settings/roles/parts/form.blade.php @@ -26,9 +26,9 @@
-
+
- {{ trans('common.toggle_all') }} + {{ trans('common.toggle_all') }}
@@ -56,20 +56,20 @@

{{ trans('settings.role_asset_admins') }}

@endif - +
- - - - + + + + @@ -187,7 +187,7 @@ @@ -205,7 +205,7 @@
- {{ trans('common.toggle_all') }} + {{ trans('common.toggle_all') }} {{ trans('common.create') }}{{ trans('common.view') }}{{ trans('common.edit') }}{{ trans('common.delete') }}{{ trans('common.create') }}{{ trans('common.view') }}{{ trans('common.edit') }}{{ trans('common.delete') }}
{{ trans('entities.shelves') }}
- {{ trans('common.toggle_all') }} + {{ trans('common.toggle_all') }}
@include('settings.roles.parts.checkbox', ['permission' => 'bookshelf-create-all', 'label' => trans('settings.role_all')]) @@ -93,7 +93,7 @@
{{ trans('entities.books') }}
- {{ trans('common.toggle_all') }} + {{ trans('common.toggle_all') }}
@include('settings.roles.parts.checkbox', ['permission' => 'book-create-all', 'label' => trans('settings.role_all')]) @@ -117,7 +117,7 @@
{{ trans('entities.chapters') }}
- {{ trans('common.toggle_all') }} + {{ trans('common.toggle_all') }}
@include('settings.roles.parts.checkbox', ['permission' => 'chapter-create-own', 'label' => trans('settings.role_own')]) @@ -143,7 +143,7 @@
{{ trans('entities.pages') }}
- {{ trans('common.toggle_all') }} + {{ trans('common.toggle_all') }}
@include('settings.roles.parts.checkbox', ['permission' => 'page-create-own', 'label' => trans('settings.role_own')]) @@ -169,7 +169,7 @@
{{ trans('entities.images') }}
- {{ trans('common.toggle_all') }} + {{ trans('common.toggle_all') }}
@include('settings.roles.parts.checkbox', ['permission' => 'image-create-all', 'label' => '']) {{ trans('settings.role_controlled_by_asset') }}1
{{ trans('entities.attachments') }}
- {{ trans('common.toggle_all') }} + {{ trans('common.toggle_all') }}
@include('settings.roles.parts.checkbox', ['permission' => 'attachment-create-all', 'label' => '']) {{ trans('settings.role_controlled_by_asset') }}
{{ trans('entities.comments') }}
- {{ trans('common.toggle_all') }} + {{ trans('common.toggle_all') }}
@include('settings.roles.parts.checkbox', ['permission' => 'comment-create-all', 'label' => '']) {{ trans('settings.role_controlled_by_asset') }}