mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Merge branch 'development' into bugfix/fix-being-unable-to-clear-filters
This commit is contained in:
1
resources/icons/groups.svg
Normal file
1
resources/icons/groups.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px"><g><path d="M12,12.75c1.63,0,3.07,0.39,4.24,0.9c1.08,0.48,1.76,1.56,1.76,2.73L18,17c0,0.55-0.45,1-1,1H7c-0.55,0-1-0.45-1-1l0-0.61 c0-1.18,0.68-2.26,1.76-2.73C8.93,13.14,10.37,12.75,12,12.75z M4,13c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2s-2,0.9-2,2 C2,12.1,2.9,13,4,13z M5.13,14.1C4.76,14.04,4.39,14,4,14c-0.99,0-1.93,0.21-2.78,0.58C0.48,14.9,0,15.62,0,16.43L0,17 c0,0.55,0.45,1,1,1l3.5,0v-1.61C4.5,15.56,4.73,14.78,5.13,14.1z M20,13c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2s-2,0.9-2,2 C18,12.1,18.9,13,20,13z M24,16.43c0-0.81-0.48-1.53-1.22-1.85C21.93,14.21,20.99,14,20,14c-0.39,0-0.76,0.04-1.13,0.1 c0.4,0.68,0.63,1.46,0.63,2.29V18l3.5,0c0.55,0,1-0.45,1-1L24,16.43z M12,6c1.66,0,3,1.34,3,3c0,1.66-1.34,3-3,3s-3-1.34-3-3 C9,7.34,10.34,6,12,6z"/></g></svg>
|
After Width: | Height: | Size: 811 B |
4
resources/icons/role.svg
Normal file
4
resources/icons/role.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 415 B |
@ -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;
|
80
resources/js/components/entity-permissions.js
Normal file
80
resources/js/components/entity-permissions.js
Normal file
@ -0,0 +1,80 @@
|
||||
/**
|
||||
* @extends {Component}
|
||||
*/
|
||||
class EntityPermissions {
|
||||
|
||||
setup() {
|
||||
this.container = this.$el;
|
||||
this.entityType = this.$opts.entityType;
|
||||
|
||||
this.everyoneInheritToggle = this.$refs.everyoneInherit;
|
||||
this.roleSelect = this.$refs.roleSelect;
|
||||
this.roleContainer = this.$refs.roleContainer;
|
||||
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
setupListeners() {
|
||||
// "Everyone Else" inherit toggle
|
||||
this.everyoneInheritToggle.addEventListener('change', event => {
|
||||
const inherit = event.target.checked;
|
||||
const permissions = document.querySelectorAll('input[name^="permissions[0]["]');
|
||||
for (const permission of permissions) {
|
||||
permission.disabled = inherit;
|
||||
permission.checked = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Remove role row button click
|
||||
this.container.addEventListener('click', event => {
|
||||
const button = event.target.closest('button');
|
||||
if (button && button.dataset.roleId) {
|
||||
this.removeRowOnButtonClick(button)
|
||||
}
|
||||
});
|
||||
|
||||
// Role select change
|
||||
this.roleSelect.addEventListener('change', event => {
|
||||
const roleId = this.roleSelect.value;
|
||||
if (roleId) {
|
||||
this.addRoleRow(roleId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async addRoleRow(roleId) {
|
||||
this.roleSelect.disabled = true;
|
||||
|
||||
// Remove option from select
|
||||
const option = this.roleSelect.querySelector(`option[value="${roleId}"]`);
|
||||
if (option) {
|
||||
option.remove();
|
||||
}
|
||||
|
||||
// Get and insert new row
|
||||
const resp = await window.$http.get(`/permissions/form-row/${this.entityType}/${roleId}`);
|
||||
const wrap = document.createElement('div');
|
||||
wrap.innerHTML = resp.data;
|
||||
const row = wrap.children[0];
|
||||
this.roleContainer.append(row);
|
||||
window.components.init(row);
|
||||
|
||||
this.roleSelect.disabled = false;
|
||||
}
|
||||
|
||||
removeRowOnButtonClick(button) {
|
||||
const row = button.closest('.content-permissions-row');
|
||||
const roleId = button.dataset.roleId;
|
||||
const roleName = button.dataset.roleName;
|
||||
|
||||
const option = document.createElement('option');
|
||||
option.value = roleId;
|
||||
option.textContent = roleName;
|
||||
|
||||
this.roleSelect.append(option);
|
||||
row.remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default EntityPermissions;
|
@ -18,7 +18,7 @@ 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 entityPermissions from "./entity-permissions";
|
||||
import entitySearch from "./entity-search.js"
|
||||
import entitySelector from "./entity-selector.js"
|
||||
import entitySelectorPopup from "./entity-selector-popup.js"
|
||||
@ -75,7 +75,7 @@ const componentMapping = {
|
||||
"dropdown-search": dropdownSearch,
|
||||
"dropzone": dropzone,
|
||||
"editor-toolbox": editorToolbox,
|
||||
"entity-permissions-editor": entityPermissionsEditor,
|
||||
"entity-permissions": entityPermissions,
|
||||
"entity-search": entitySearch,
|
||||
"entity-selector": entitySelector,
|
||||
"entity-selector-popup": entitySelectorPopup,
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -42,10 +42,14 @@ 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_desc' => 'Set permissions here to override the default permissions provided by user roles.',
|
||||
'permissions_book_cascade' => 'Permissions set on books will automatically cascade to child chapters and pages, unless they have their own permissions defined.',
|
||||
'permissions_chapter_cascade' => 'Permissions set on chapters will automatically cascade to child pages, unless they have their own permissions defined.',
|
||||
'permissions_save' => 'Save Permissions',
|
||||
'permissions_owner' => 'Owner',
|
||||
'permissions_role_everyone_else' => 'Everyone Else',
|
||||
'permissions_role_everyone_else_desc' => 'Set permissions for all roles not specifically overridden.',
|
||||
'permissions_role_override' => 'Override permissions for role',
|
||||
|
||||
// Search
|
||||
'search_results' => 'Search Results',
|
||||
|
@ -48,9 +48,10 @@ button {
|
||||
|
||||
.button.outline {
|
||||
background-color: transparent;
|
||||
@include lightDark(color, #666, #aaa);
|
||||
@include lightDark(color, #666, #AAA);
|
||||
fill: currentColor;
|
||||
border: 1px solid #CCC;
|
||||
border: 1px solid;
|
||||
@include lightDark(border-color, #CCC, #666);
|
||||
&:hover, &:focus, &:active {
|
||||
border: 1px solid #CCC;
|
||||
box-shadow: none;
|
||||
@ -109,12 +110,23 @@ button {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.button.icon {
|
||||
.button.icon, .icon-button {
|
||||
.svg-icon {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-button {
|
||||
text-align: center;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.icon-button:hover {
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
border-radius: 4px;
|
||||
@include lightDark(border-color, #DDD, #444);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button.svg {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -798,11 +798,35 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group {
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.permissions-table [permissions-table-toggle-all-in-row] {
|
||||
display: none;
|
||||
.content-permissions {
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.permissions-table tr:hover [permissions-table-toggle-all-in-row] {
|
||||
display: inline;
|
||||
.content-permissions-row {
|
||||
border: 1.5px solid;
|
||||
@include lightDark(border-color, #E2E2E2, #444);
|
||||
border-bottom-width: 0;
|
||||
label {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
&:hover {
|
||||
@include lightDark(background-color, #F2F2F2, #333);
|
||||
}
|
||||
}
|
||||
.content-permissions-row:first-child {
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
.content-permissions-row:last-child {
|
||||
border-radius: 0 0 4px 4px;
|
||||
border-bottom-width: 1.5px;
|
||||
}
|
||||
.content-permissions-row:first-child:last-child {
|
||||
border-radius: 4px;
|
||||
}
|
||||
.content-permissions-row-toggle-all {
|
||||
visibility: hidden;
|
||||
}
|
||||
.content-permissions-row:hover .content-permissions-row-toggle-all {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.template-item {
|
||||
@ -857,7 +881,8 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group {
|
||||
gap: $-s;
|
||||
line-height: normal;
|
||||
.svg-icon {
|
||||
height: 16px;
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
margin: 0;
|
||||
}
|
||||
.avatar {
|
||||
@ -879,10 +904,11 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.dropdown-search-toggle-select-caret {
|
||||
font-size: 1.5rem;
|
||||
line-height: 0;
|
||||
margin-left: auto;
|
||||
margin-top: -2px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dropdown-search-dropdown {
|
||||
|
@ -207,8 +207,8 @@ select {
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23666666'><polygon points='0,0 100,0 50,50'/></svg>");
|
||||
background-size: 12px;
|
||||
background-position: calc(100% - 20px) 70%;
|
||||
background-size: 10px 12px;
|
||||
background-position: calc(100% - 20px) 64%;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
@include rtl {
|
||||
@ -266,6 +266,15 @@ input[type=color] {
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
opacity: 0.8;
|
||||
}
|
||||
input[type=checkbox][disabled] ~ * {
|
||||
opacity: 0.8;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
input[type=checkbox][disabled] ~ .custom-checkbox {
|
||||
border-color: #999;
|
||||
color: #999 !important;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
}
|
||||
.toggle-switch-list {
|
||||
.toggle-switch {
|
||||
|
@ -158,8 +158,8 @@ body.flexbox {
|
||||
}
|
||||
}
|
||||
|
||||
.gap-m {
|
||||
gap: $-m;
|
||||
.flex-none {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.justify-flex-start {
|
||||
|
@ -29,4 +29,16 @@
|
||||
}
|
||||
}
|
||||
@include spacing('margin', 'm');
|
||||
@include spacing('padding', 'p');
|
||||
@include spacing('padding', 'p');
|
||||
|
||||
@each $sizeLetter, $size in $spacing {
|
||||
.gap-#{$sizeLetter} {
|
||||
gap: $size !important;
|
||||
}
|
||||
.gap-x-#{$sizeLetter} {
|
||||
column-gap: $size !important;
|
||||
}
|
||||
.gap-y-#{$sizeLetter} {
|
||||
row-gap: $size !important;
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,8 @@
|
||||
]])
|
||||
</div>
|
||||
|
||||
<main class="card content-wrap">
|
||||
<h1 class="list-heading">{{ trans('entities.books_permissions') }}</h1>
|
||||
@include('form.entity-permissions', ['model' => $book])
|
||||
<main class="card content-wrap auto-height">
|
||||
@include('form.entity-permissions', ['model' => $book, 'title' => trans('entities.books_permissions')])
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
||||
<h5>{{ trans('common.details') }}</h5>
|
||||
<div class="blended-links">
|
||||
@include('entities.meta', ['entity' => $book])
|
||||
@if($book->restricted)
|
||||
@if($book->hasPermissions())
|
||||
<div class="active-restriction">
|
||||
@if(userCan('restrictions-manage', $book))
|
||||
<a href="{{ $book->getUrl('/permissions') }}" class="entity-meta-item">
|
||||
|
@ -15,9 +15,8 @@
|
||||
]])
|
||||
</div>
|
||||
|
||||
<main class="card content-wrap">
|
||||
<h1 class="list-heading">{{ trans('entities.chapters_permissions') }}</h1>
|
||||
@include('form.entity-permissions', ['model' => $chapter])
|
||||
<main class="card content-wrap auto-height">
|
||||
@include('form.entity-permissions', ['model' => $chapter, 'title' => trans('entities.chapters_permissions')])
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
||||
<div class="blended-links">
|
||||
@include('entities.meta', ['entity' => $chapter])
|
||||
|
||||
@if($book->restricted)
|
||||
@if($book->hasPermissions())
|
||||
<div class="active-restriction">
|
||||
@if(userCan('restrictions-manage', $book))
|
||||
<a href="{{ $book->getUrl('/permissions') }}" class="entity-meta-item">
|
||||
@ -85,7 +85,7 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($chapter->restricted)
|
||||
@if($chapter->hasPermissions())
|
||||
<div class="active-restriction">
|
||||
@if(userCan('restrictions-manage', $chapter))
|
||||
<a href="{{ $chapter->getUrl('/permissions') }}" class="entity-meta-item">
|
||||
|
@ -5,7 +5,7 @@ $checked
|
||||
$label
|
||||
--}}
|
||||
<label custom-checkbox class="toggle-switch @if($errors->has($name)) text-neg @endif">
|
||||
<input type="checkbox" name="{{$name}}" value="{{ $value }}" @if($checked) checked="checked" @endif>
|
||||
<input type="checkbox" name="{{$name}}" value="{{ $value }}" @if($checked) checked="checked" @endif @if($disabled ?? false) disabled="disabled" @endif>
|
||||
<span tabindex="0" role="checkbox"
|
||||
aria-checked="{{ $checked ? 'true' : 'false' }}"
|
||||
class="custom-checkbox text-primary">@icon('check')</span>
|
||||
|
88
resources/views/form/entity-permissions-row.blade.php
Normal file
88
resources/views/form/entity-permissions-row.blade.php
Normal file
@ -0,0 +1,88 @@
|
||||
{{--
|
||||
$role - The Role to display this row for.
|
||||
$entityType - String identifier for type of entity having permissions applied.
|
||||
$permission - The entity permission containing the permissions.
|
||||
$inheriting - Boolean if the current row should be marked as inheriting default permissions. Used for "Everyone Else" role.
|
||||
--}}
|
||||
|
||||
<div component="permissions-table" class="content-permissions-row flex-container-row justify-space-between wrap">
|
||||
<div class="gap-x-m flex-container-row items-center px-l py-m flex">
|
||||
<div class="text-large" title="{{ $role->id === 0 ? trans('entities.permissions_role_everyone_else') : trans('common.role') }}">
|
||||
@icon($role->id === 0 ? 'groups' : 'role')
|
||||
</div>
|
||||
<span>
|
||||
<strong>{{ $role->display_name }}</strong> <br>
|
||||
<small class="text-muted">{{ $role->description }}</small>
|
||||
</span>
|
||||
@if($role->id !== 0)
|
||||
<button type="button"
|
||||
class="ml-auto flex-none text-small text-primary text-button hover-underline content-permissions-row-toggle-all hide-under-s"
|
||||
refs="permissions-table@toggle-all"
|
||||
><strong>{{ trans('common.toggle_all') }}</strong></button>
|
||||
@endif
|
||||
</div>
|
||||
@if($role->id === 0)
|
||||
<div class="px-l flex-container-row items-center" refs="entity-permissions@everyone-inherit">
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => 'entity-permissions-inherit',
|
||||
'label' => 'Inherit defaults',
|
||||
'value' => 'true',
|
||||
'checked' => $inheriting
|
||||
])
|
||||
</div>
|
||||
@endif
|
||||
<div class="flex-container-row justify-space-between gap-x-xl wrap items-center">
|
||||
<input type="hidden" name="permissions[{{ $role->id }}][active]"
|
||||
@if($inheriting) disabled="disabled" @endif
|
||||
value="true">
|
||||
<div class="px-l">
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => 'permissions[' . $role->id . '][view]',
|
||||
'label' => trans('common.view'),
|
||||
'value' => 'true',
|
||||
'checked' => $permission->view,
|
||||
'disabled' => $inheriting
|
||||
])
|
||||
</div>
|
||||
@if($entityType !== 'page')
|
||||
<div class="px-l">
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => 'permissions[' . $role->id . '][create]',
|
||||
'label' => trans('common.create'),
|
||||
'value' => 'true',
|
||||
'checked' => $permission->create,
|
||||
'disabled' => $inheriting
|
||||
])
|
||||
</div>
|
||||
@endif
|
||||
<div class="px-l">
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => 'permissions[' . $role->id . '][update]',
|
||||
'label' => trans('common.update'),
|
||||
'value' => 'true',
|
||||
'checked' => $permission->update,
|
||||
'disabled' => $inheriting
|
||||
])
|
||||
</div>
|
||||
<div class="px-l">
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => 'permissions[' . $role->id . '][delete]',
|
||||
'label' => trans('common.delete'),
|
||||
'value' => 'true',
|
||||
'checked' => $permission->delete,
|
||||
'disabled' => $inheriting
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
@if($role->id !== 0)
|
||||
<div class="flex-container-row items-center px-m py-s">
|
||||
<button type="button"
|
||||
class="text-neg p-m icon-button"
|
||||
data-role-id="{{ $role->id }}"
|
||||
data-role-name="{{ $role->display_name }}"
|
||||
title="{{ trans('common.remove') }}">
|
||||
@icon('close') <span class="hide-over-m ml-xs">{{ trans('common.remove') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
@ -1,54 +1,73 @@
|
||||
<form action="{{ $model->getUrl('/permissions') }}" method="POST" entity-permissions-editor>
|
||||
<?php
|
||||
/** @var \BookStack\Auth\Permissions\PermissionFormData $data */
|
||||
?>
|
||||
<form component="entity-permissions"
|
||||
option:entity-permissions:entity-type="{{ $model->getType() }}"
|
||||
action="{{ $model->getUrl('/permissions') }}"
|
||||
method="POST">
|
||||
{!! csrf_field() !!}
|
||||
<input type="hidden" name="_method" value="PUT">
|
||||
|
||||
<div class="grid half left-focus v-center">
|
||||
<div class="grid half left-focus v-end gap-m wrap">
|
||||
<div>
|
||||
<p class="mb-none mt-m">{{ trans('entities.permissions_intro') }}</p>
|
||||
<div>
|
||||
@include('form.checkbox', [
|
||||
'name' => 'restricted',
|
||||
'label' => trans('entities.permissions_enable'),
|
||||
])
|
||||
</div>
|
||||
<h1 class="list-heading">{{ $title }}</h1>
|
||||
<p class="text-muted mb-s">
|
||||
{{ trans('entities.permissions_desc') }}
|
||||
|
||||
@if($model instanceof \BookStack\Entities\Models\Book)
|
||||
<br> {{ trans('entities.permissions_book_cascade') }}
|
||||
@elseif($model instanceof \BookStack\Entities\Models\Chapter)
|
||||
<br> {{ trans('entities.permissions_chapter_cascade') }}
|
||||
@endif
|
||||
</p>
|
||||
|
||||
@if($model instanceof \BookStack\Entities\Models\Bookshelf)
|
||||
<p class="text-warn">{{ trans('entities.shelves_permissions_cascade_warning') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<div class="flex-container-row justify-flex-end">
|
||||
<div class="form-group mb-m">
|
||||
<label for="owner">{{ trans('entities.permissions_owner') }}</label>
|
||||
@include('form.user-select', ['user' => $model->ownedBy, 'name' => 'owned_by'])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($model instanceof \BookStack\Entities\Models\Bookshelf)
|
||||
<p class="text-warn">{{ trans('entities.shelves_permissions_cascade_warning') }}</p>
|
||||
@endif
|
||||
|
||||
<hr>
|
||||
|
||||
<table permissions-table class="table permissions-table toggle-switch-list" style="{{ !$model->restricted ? 'display: none' : '' }}">
|
||||
<tr>
|
||||
<th>{{ trans('common.role') }}</th>
|
||||
<th colspan="{{ $model->isA('page') ? '3' : '4' }}">
|
||||
{{ trans('common.actions') }}
|
||||
<a href="#" permissions-table-toggle-all class="text-small ml-m text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</th>
|
||||
</tr>
|
||||
@foreach(\BookStack\Auth\Role::restrictable() as $role)
|
||||
<tr>
|
||||
<td width="33%" class="pt-m">
|
||||
{{ $role->display_name }}
|
||||
<a href="#" permissions-table-toggle-all-in-row class="text-small float right ml-m text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</td>
|
||||
<td>@include('form.restriction-checkbox', ['name'=>'restrictions', 'label' => trans('common.view'), 'action' => 'view'])</td>
|
||||
@if(!$model->isA('page'))
|
||||
<td>@include('form.restriction-checkbox', ['name'=>'restrictions', 'label' => trans('common.create'), 'action' => 'create'])</td>
|
||||
@endif
|
||||
<td>@include('form.restriction-checkbox', ['name'=>'restrictions', 'label' => trans('common.update'), 'action' => 'update'])</td>
|
||||
<td>@include('form.restriction-checkbox', ['name'=>'restrictions', 'label' => trans('common.delete'), 'action' => 'delete'])</td>
|
||||
</tr>
|
||||
<div refs="entity-permissions@role-container" class="content-permissions mt-m mb-m">
|
||||
@foreach($data->permissionsWithRoles() as $permission)
|
||||
@include('form.entity-permissions-row', [
|
||||
'permission' => $permission,
|
||||
'role' => $permission->role,
|
||||
'entityType' => $model->getType(),
|
||||
'inheriting' => false,
|
||||
])
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="flex-container-row justify-flex-end mb-xl">
|
||||
<div class="flex-container-row items-center gap-m">
|
||||
<label for="role_select" class="m-none p-none"><span class="bold">{{ trans('entities.permissions_role_override') }}</span></label>
|
||||
<select name="role_select" id="role_select" refs="entity-permissions@role-select">
|
||||
<option value="">{{ trans('common.select') }}</option>
|
||||
@foreach($data->rolesNotAssigned() as $role)
|
||||
<option value="{{ $role->id }}">{{ $role->display_name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-permissions mt-m mb-xl">
|
||||
@include('form.entity-permissions-row', [
|
||||
'role' => $data->everyoneElseRole(),
|
||||
'permission' => $data->everyoneElseEntityPermission(),
|
||||
'entityType' => $model->getType(),
|
||||
'inheriting' => !$model->permissions()->where('role_id', '=', 0)->exists(),
|
||||
])
|
||||
</div>
|
||||
|
||||
<hr class="mb-m">
|
||||
|
||||
<div class="text-right">
|
||||
<a href="{{ $model->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
|
@ -1,13 +0,0 @@
|
||||
{{--
|
||||
$name
|
||||
$label
|
||||
$role
|
||||
$action
|
||||
$model?
|
||||
--}}
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => $name . '[' . $role->id . '][' . $action . ']',
|
||||
'label' => $label,
|
||||
'value' => 'true',
|
||||
'checked' => isset($model) && $model->hasRestriction($role->id, $action)
|
||||
])
|
@ -16,9 +16,8 @@
|
||||
]])
|
||||
</div>
|
||||
|
||||
<main class="card content-wrap">
|
||||
<h1 class="list-heading">{{ trans('entities.pages_permissions') }}</h1>
|
||||
@include('form.entity-permissions', ['model' => $page])
|
||||
<main class="card content-wrap auto-height">
|
||||
@include('form.entity-permissions', ['model' => $page, 'title' => trans('entities.pages_permissions')])
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
<div class="blended-links">
|
||||
@include('entities.meta', ['entity' => $page])
|
||||
|
||||
@if($book->restricted)
|
||||
@if($book->hasPermissions())
|
||||
<div class="active-restriction">
|
||||
@if(userCan('restrictions-manage', $book))
|
||||
<a href="{{ $book->getUrl('/permissions') }}" class="entity-meta-item">
|
||||
@ -97,7 +97,7 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($page->chapter && $page->chapter->restricted)
|
||||
@if($page->chapter && $page->chapter->hasPermissions())
|
||||
<div class="active-restriction">
|
||||
@if(userCan('restrictions-manage', $page->chapter))
|
||||
<a href="{{ $page->chapter->getUrl('/permissions') }}" class="entity-meta-item">
|
||||
@ -113,7 +113,7 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($page->restricted)
|
||||
@if($page->hasPermissions())
|
||||
<div class="active-restriction">
|
||||
@if(userCan('restrictions-manage', $page))
|
||||
<a href="{{ $page->getUrl('/permissions') }}" class="entity-meta-item">
|
||||
|
@ -26,9 +26,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div permissions-table>
|
||||
<div component="permissions-table">
|
||||
<label class="setting-list-label">{{ trans('settings.role_system') }}</label>
|
||||
<a href="#" permissions-table-toggle-all class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
<a href="#" refs="permissions-table@toggle-all" class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
|
||||
<div class="toggle-switch-list grid half mt-m">
|
||||
<div>
|
||||
@ -56,20 +56,20 @@
|
||||
<p class="text-warn">{{ trans('settings.role_asset_admins') }}</p>
|
||||
@endif
|
||||
|
||||
<table permissions-table class="table toggle-switch-list compact permissions-table">
|
||||
<table component="permissions-table" class="table toggle-switch-list compact permissions-table">
|
||||
<tr>
|
||||
<th width="20%">
|
||||
<a href="#" permissions-table-toggle-all class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
<a href="#" refs="permissions-table@toggle-all" class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</th>
|
||||
<th width="20%" permissions-table-toggle-all-in-column>{{ trans('common.create') }}</th>
|
||||
<th width="20%" permissions-table-toggle-all-in-column>{{ trans('common.view') }}</th>
|
||||
<th width="20%" permissions-table-toggle-all-in-column>{{ trans('common.edit') }}</th>
|
||||
<th width="20%" permissions-table-toggle-all-in-column>{{ trans('common.delete') }}</th>
|
||||
<th width="20%" refs="permissions-table@toggle-column">{{ trans('common.create') }}</th>
|
||||
<th width="20%" refs="permissions-table@toggle-column">{{ trans('common.view') }}</th>
|
||||
<th width="20%" refs="permissions-table@toggle-column">{{ trans('common.edit') }}</th>
|
||||
<th width="20%" refs="permissions-table@toggle-column">{{ trans('common.delete') }}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div>{{ trans('entities.shelves') }}</div>
|
||||
<a href="#" permissions-table-toggle-all-in-row class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
<a href="#" refs="permissions-table@toggle-row" class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</td>
|
||||
<td>
|
||||
@include('settings.roles.parts.checkbox', ['permission' => 'bookshelf-create-all', 'label' => trans('settings.role_all')])
|
||||
@ -93,7 +93,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div>{{ trans('entities.books') }}</div>
|
||||
<a href="#" permissions-table-toggle-all-in-row class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
<a href="#" refs="permissions-table@toggle-row" class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</td>
|
||||
<td>
|
||||
@include('settings.roles.parts.checkbox', ['permission' => 'book-create-all', 'label' => trans('settings.role_all')])
|
||||
@ -117,7 +117,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div>{{ trans('entities.chapters') }}</div>
|
||||
<a href="#" permissions-table-toggle-all-in-row class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
<a href="#" refs="permissions-table@toggle-row" class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</td>
|
||||
<td>
|
||||
@include('settings.roles.parts.checkbox', ['permission' => 'chapter-create-own', 'label' => trans('settings.role_own')])
|
||||
@ -143,7 +143,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div>{{ trans('entities.pages') }}</div>
|
||||
<a href="#" permissions-table-toggle-all-in-row class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
<a href="#" refs="permissions-table@toggle-row" class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</td>
|
||||
<td>
|
||||
@include('settings.roles.parts.checkbox', ['permission' => 'page-create-own', 'label' => trans('settings.role_own')])
|
||||
@ -169,7 +169,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div>{{ trans('entities.images') }}</div>
|
||||
<a href="#" permissions-table-toggle-all-in-row class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
<a href="#" refs="permissions-table@toggle-row" class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</td>
|
||||
<td>@include('settings.roles.parts.checkbox', ['permission' => 'image-create-all', 'label' => ''])</td>
|
||||
<td style="line-height:1.2;"><small class="faded">{{ trans('settings.role_controlled_by_asset') }}<sup>1</sup></small></td>
|
||||
@ -187,7 +187,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div>{{ trans('entities.attachments') }}</div>
|
||||
<a href="#" permissions-table-toggle-all-in-row class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
<a href="#" refs="permissions-table@toggle-row" class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</td>
|
||||
<td>@include('settings.roles.parts.checkbox', ['permission' => 'attachment-create-all', 'label' => ''])</td>
|
||||
<td style="line-height:1.2;"><small class="faded">{{ trans('settings.role_controlled_by_asset') }}</small></td>
|
||||
@ -205,7 +205,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div>{{ trans('entities.comments') }}</div>
|
||||
<a href="#" permissions-table-toggle-all-in-row class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
<a href="#" refs="permissions-table@toggle-row" class="text-small text-primary">{{ trans('common.toggle_all') }}</a>
|
||||
</td>
|
||||
<td>@include('settings.roles.parts.checkbox', ['permission' => 'comment-create-all', 'label' => ''])</td>
|
||||
<td style="line-height:1.2;"><small class="faded">{{ trans('settings.role_controlled_by_asset') }}</small></td>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
@section('body')
|
||||
|
||||
<div class="container small">
|
||||
<div class="container">
|
||||
|
||||
<div class="my-s">
|
||||
@include('entities.breadcrumbs', ['crumbs' => [
|
||||
@ -15,14 +15,15 @@
|
||||
</div>
|
||||
|
||||
<div class="card content-wrap auto-height">
|
||||
<h1 class="list-heading">{{ trans('entities.shelves_permissions') }}</h1>
|
||||
@include('form.entity-permissions', ['model' => $shelf])
|
||||
@include('form.entity-permissions', ['model' => $shelf, 'title' => trans('entities.shelves_permissions')])
|
||||
</div>
|
||||
|
||||
<div class="card content-wrap auto-height">
|
||||
<h2 class="list-heading">{{ trans('entities.shelves_copy_permissions_to_books') }}</h2>
|
||||
<p>{{ trans('entities.shelves_copy_permissions_explain') }}</p>
|
||||
<form action="{{ $shelf->getUrl('/copy-permissions') }}" method="post" class="text-right">
|
||||
<div class="card content-wrap auto-height flex-container-row items-center gap-x-xl wrap">
|
||||
<div class="flex">
|
||||
<h2 class="list-heading">{{ trans('entities.shelves_copy_permissions_to_books') }}</h2>
|
||||
<p>{{ trans('entities.shelves_copy_permissions_explain') }}</p>
|
||||
</div>
|
||||
<form action="{{ $shelf->getUrl('/copy-permissions') }}" method="post" class="flex text-right">
|
||||
{{ csrf_field() }}
|
||||
<button class="button">{{ trans('entities.shelves_copy_permissions') }}</button>
|
||||
</form>
|
||||
|
@ -85,7 +85,7 @@
|
||||
<h5>{{ trans('common.details') }}</h5>
|
||||
<div class="blended-links">
|
||||
@include('entities.meta', ['entity' => $shelf])
|
||||
@if($shelf->restricted)
|
||||
@if($shelf->hasPermissions())
|
||||
<div class="active-restriction">
|
||||
@if(userCan('restrictions-manage', $shelf))
|
||||
<a href="{{ $shelf->getUrl('/permissions') }}" class="entity-meta-item">
|
||||
|
Reference in New Issue
Block a user