Updated auth pages to new design, Removed public layout

This commit is contained in:
Dan Brown 2019-02-03 17:34:15 +00:00
parent 138f5d5c4f
commit 5325870271
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
31 changed files with 521 additions and 577 deletions

View File

@ -1,6 +1,7 @@
<?php namespace BookStack\Auth;
use BookStack\Auth\Permissions\JointPermission;
use BookStack\Auth\Permissions\RolePermission;
use BookStack\Model;
class Role extends Model
@ -13,7 +14,7 @@ class Role extends Model
*/
public function users()
{
return $this->belongsToMany(User::class);
return $this->belongsToMany(User::class)->orderBy('name', 'asc');
}
/**
@ -30,7 +31,7 @@ class Role extends Model
*/
public function permissions()
{
return $this->belongsToMany(Permissions\RolePermission::class, 'permission_role', 'role_id', 'permission_id');
return $this->belongsToMany(RolePermission::class, 'permission_role', 'role_id', 'permission_id');
}
/**
@ -51,18 +52,18 @@ class Role extends Model
/**
* Add a permission to this role.
* @param \BookStack\Auth\Permissions\RolePermission $permission
* @param RolePermission $permission
*/
public function attachPermission(Permissions\RolePermission $permission)
public function attachPermission(RolePermission $permission)
{
$this->permissions()->attach($permission->id);
}
/**
* Detach a single permission from this role.
* @param \BookStack\Auth\Permissions\RolePermission $permission
* @param RolePermission $permission
*/
public function detachPermission(Permissions\RolePermission $permission)
public function detachPermission(RolePermission $permission)
{
$this->permissions()->detach($permission->id);
}

View File

@ -26,7 +26,7 @@ class PermissionController extends Controller
{
$this->checkPermission('user-roles-manage');
$roles = $this->permissionsRepo->getAllRoles();
return view('settings/roles/index', ['roles' => $roles]);
return view('settings.roles.index', ['roles' => $roles]);
}
/**
@ -36,7 +36,7 @@ class PermissionController extends Controller
public function createRole()
{
$this->checkPermission('user-roles-manage');
return view('settings/roles/create');
return view('settings.roles.create');
}
/**
@ -70,7 +70,7 @@ class PermissionController extends Controller
if ($role->hidden) {
throw new PermissionsException(trans('errors.role_cannot_be_edited'));
}
return view('settings/roles/edit', ['role' => $role]);
return view('settings.roles.edit', ['role' => $role]);
}
/**
@ -106,7 +106,7 @@ class PermissionController extends Controller
$roles = $this->permissionsRepo->getAllRolesExcept($role);
$blankRole = $role->newInstance(['display_name' => trans('settings.role_delete_no_migration')]);
$roles->prepend($blankRole);
return view('settings/roles/delete', ['role' => $role, 'roles' => $roles]);
return view('settings.roles.delete', ['role' => $role, 'roles' => $roles]);
}
/**

View File

@ -37,7 +37,7 @@ class Authenticate
}
}
if ($this->auth->guest() && !setting('app-public')) {
if (!hasAppAccess()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {

View File

@ -41,11 +41,19 @@ function user()
* Check if current user is a signed in user.
* @return bool
*/
function signedInUser()
function signedInUser() : bool
{
return auth()->user() && !auth()->user()->isDefault();
}
/**
* Check if the current user has general access.
* @return bool
*/
function hasAppAccess() : bool {
return !auth()->guest() || setting('app-public');
}
/**
* Check if the current user has a permission.
* If an ownable element is passed in the jointPermissions are checked against

View File

@ -176,8 +176,13 @@ input[type=date] {
opacity: 0.8;
}
}
.toggle-switch-list .toggle-switch {
.toggle-switch-list {
.toggle-switch {
margin: $-xs 0;
}
&.compact .toggle-switch {
margin: 1px 0;
}
}
.form-group {
@ -201,7 +206,8 @@ input[type=date] {
.setting-list-label + .grid {
margin-top: $-m;
}
.setting-list .grid {
.setting-list .grid, .stretch-inputs {
input[type=text], input[type=email], input[type=password], select {
width: 100%;
}
@ -329,13 +335,6 @@ div[editor-type="markdown"] .title-input.page-title input[type="text"] {
}
}
#login-form label[for="remember"] {
margin: 0;
}
#login-form label.toggle-switch {
margin-left: $-xl;
}
.image-picker img {
background-color: #BBB;
}

View File

@ -200,6 +200,9 @@ div[class^="col-"] img {
&.small {
max-width: 840px;
}
&.very-small {
max-width: 480px;
}
&.nopad {
padding-left: 0;
padding-right: 0;

View File

@ -174,6 +174,18 @@
padding: $-s $-m;
}
.user-list-item {
display: inline-grid;
padding: $-s;
grid-template-columns: min-content 1fr;
grid-column-gap: $-m;
font-size: 0.9em;
align-items: center;
> div:first-child {
line-height: 0;
}
}
ul.pagination {
display: inline-block;
list-style: none;

View File

@ -149,11 +149,8 @@ em, i, .italic {
}
small, p.small, span.small, .text-small {
font-size: 0.85em;
font-size: 0.75rem;
color: lighten($text-dark, 10%);
small, p.small, span.small, .text-small {
font-size: 1em;
}
}
sup, .superscript {

View File

@ -93,11 +93,13 @@ return [
'users_search' => 'Search Users',
'users_details' => 'User Details',
'users_details_desc' => 'Set a display name and an email address for this user. The email address will be used for logging into the application.',
'users_details_desc_no_email' => 'Set a display name for this user so others can recognise them.',
'users_role' => 'User Roles',
'users_role_desc' => 'Select which roles this user will be assigned to. If a user is assigned to multiple roles the permissions from those roles will stack and they will receive all abilities of the assigned roles.',
'users_password' => 'User Password',
'users_password_desc' => 'Set a password used to log-in to the application. This must be at least 5 characters long.',
'users_external_auth_id' => 'External Authentication ID',
'users_external_auth_id_desc' => 'This is the ID used to match this user when communicating with your LDAP system.',
'users_password_warning' => 'Only fill the below if you would like to change your password.',
'users_system_public' => 'This user represents any guest users that visit your instance. It cannot be used to log in but is assigned automatically.',
'users_delete' => 'Delete User',
@ -109,8 +111,9 @@ return [
'users_edit_profile' => 'Edit Profile',
'users_edit_success' => 'User successfully updated',
'users_avatar' => 'User Avatar',
'users_avatar_desc' => 'This image should be approx 256px square.',
'users_avatar_desc' => 'Select an image to represent this user. This should be approx 256px square.',
'users_preferred_language' => 'Preferred Language',
'users_preferred_language_desc' => 'This option will change the language used for the user-interface of the application. This will not affect any user-created content.',
'users_social_accounts' => 'Social Accounts',
'users_social_accounts_info' => 'Here you can connect your other accounts for quicker and easier login. Disconnecting an account here does not previously authorized access. Revoke access from your profile settings on the connected social account.',
'users_social_connect' => 'Connect Account',

View File

@ -1,12 +1,12 @@
<div class="form-group">
<label for="username">{{ trans('auth.username') }}</label>
@include('form/text', ['name' => 'username', 'tabindex' => 1])
@include('form.text', ['name' => 'username', 'tabindex' => 1])
</div>
@if(session('request-email', false) === true)
<div class="form-group">
<label for="email">{{ trans('auth.email') }}</label>
@include('form/text', ['name' => 'email', 'tabindex' => 1])
@include('form.text', ['name' => 'email', 'tabindex' => 1])
<span class="text-neg">
{{ trans('auth.ldap_email_hint') }}
</span>
@ -15,5 +15,5 @@
<div class="form-group">
<label for="password">{{ trans('auth.password') }}</label>
@include('form/password', ['name' => 'password', 'tabindex' => 2])
@include('form.password', ['name' => 'password', 'tabindex' => 2])
</div>

View File

@ -1,10 +1,10 @@
<div class="form-group">
<label for="email">{{ trans('auth.email') }}</label>
@include('form/text', ['name' => 'email', 'tabindex' => 1])
@include('form.text', ['name' => 'email', 'tabindex' => 1])
</div>
<div class="form-group">
<label for="password">{{ trans('auth.password') }}</label>
@include('form/password', ['name' => 'password', 'tabindex' => 2])
<span class="block small"><a href="{{ baseUrl('/password/email') }}">{{ trans('auth.forgot_password') }}</a></span>
@include('form.password', ['name' => 'password', 'tabindex' => 2])
<span class="block small mt-s"><a href="{{ baseUrl('/password/email') }}">{{ trans('auth.forgot_password') }}</a></span>
</div>

View File

@ -1,45 +1,49 @@
@extends('public')
@section('header-buttons')
@if(setting('registration-enabled', false))
<a href="{{ baseUrl("/register") }}">@icon('new-user') {{ trans('auth.sign_up') }}</a>
@endif
@stop
@extends('simple-layout')
@section('content')
<div class="text-center">
<div class="card center-box">
<h3>@icon('login') {{ title_case(trans('auth.log_in')) }}</h3>
<div class="container very-small">
<div class="body">
<form action="{{ baseUrl("/login") }}" method="POST" id="login-form">
<div class="my-l">&nbsp;</div>
<div class="card content-wrap">
<h1 class="list-heading">{{ title_case(trans('auth.log_in')) }}</h1>
<form action="{{ baseUrl("/login") }}" method="POST" id="login-form" class="mt-l">
{!! csrf_field() !!}
<div class="stretch-inputs">
@include('auth/forms/login/' . $authMethod)
<div class="form-group">
<label for="remember" class="inline">{{ trans('auth.remember_me') }}</label>
<input type="checkbox" id="remember" name="remember" class="toggle-switch-checkbox">
<label for="remember" class="toggle-switch"></label>
</div>
<div class="from-group">
<button class="button block pos" tabindex="3">@icon('login') {{ title_case(trans('auth.log_in')) }}</button>
<div class="grid half large-gap v-center">
<div class="text-left ml-xxs">
@include('components.custom-checkbox', [
'name' => 'remember',
'checked' => false,
'value' => 'on',
'label' => trans('auth.remember_me'),
])
</div>
<div class="text-right">
<button class="button primary" tabindex="3">{{ title_case(trans('auth.log_in')) }}</button>
</div>
</div>
</form>
@if(count($socialDrivers) > 0)
<hr class="margin-top">
<hr class="my-l">
@foreach($socialDrivers as $driver => $name)
<div>
<a id="social-login-{{$driver}}" class="button block muted-light svg text-left" href="{{ baseUrl("/login/service/" . $driver) }}">
@icon('auth/' . $driver)
{{ trans('auth.log_in_with', ['socialDriver' => $name]) }}
</a>
</div>
@endforeach
@endif
</div>
</div>
</div>
@stop

View File

@ -1,23 +1,13 @@
@extends('public')
@section('header-buttons')
<a href="{{ baseUrl("/login") }}">@icon('login') {{ trans('auth.log_in') }}</a>
@if(setting('registration-enabled'))
<a href="{{ baseUrl("/register") }}">@icon('new-user') {{ trans('auth.sign_up') }}</a>
@endif
@stop
@extends('simple-layout')
@section('content')
<div class="container very-small mt-xl">
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('auth.reset_password') }}</h1>
<div class="text-center">
<div class="card center-box">
<h3>@icon('permission') {{ trans('auth.reset_password') }}</h3>
<div class="body">
<p class="muted small">{{ trans('auth.reset_password_send_instructions') }}</p>
<form action="{{ baseUrl("/password/email") }}" method="POST">
<form action="{{ baseUrl("/password/email") }}" method="POST" class="stretch-inputs">
{!! csrf_field() !!}
<div class="form-group">
@ -25,13 +15,11 @@
@include('form/text', ['name' => 'email'])
</div>
<div class="from-group text-right">
<div class="from-group text-right mt-m">
<button class="button primary">{{ trans('auth.reset_password_send_button') }}</button>
</div>
</form>
</div>
</div>
</div>
@stop

View File

@ -1,43 +1,34 @@
@extends('public')
@section('header-buttons')
<a href="{{ baseUrl("/login") }}">@icon('login') {{ trans('auth.log_in') }}</a>
@if(setting('registration-enabled'))
<a href="{{ baseUrl("/register") }}">@icon('new-user') {{ trans('auth.sign_up') }}</a>
@endif
@stop
@extends('simple-layout')
@section('content')
<div class="text-center">
<div class="card center-box">
<h3>@icon('permission') {{ trans('auth.reset_password') }}</h3>
<div class="container very-small mt-xl">
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('auth.reset_password') }}</h1>
<div class="body">
<form action="{{ baseUrl("/password/reset") }}" method="POST">
<form action="{{ baseUrl("/password/reset") }}" method="POST" class="stretch-inputs">
{!! csrf_field() !!}
<input type="hidden" name="token" value="{{ $token }}">
<div class="form-group">
<label for="email">{{ trans('auth.email') }}</label>
@include('form/text', ['name' => 'email'])
@include('form.text', ['name' => 'email'])
</div>
<div class="form-group">
<label for="password">{{ trans('auth.password') }}</label>
@include('form/password', ['name' => 'password'])
@include('form.password', ['name' => 'password'])
</div>
<div class="form-group">
<label for="password_confirmation">{{ trans('auth.password_confirm') }}</label>
@include('form/password', ['name' => 'password_confirmation'])
@include('form.password', ['name' => 'password_confirmation'])
</div>
<div class="from-group text-right">
<div class="from-group text-right mt-m">
<button class="button primary">{{ trans('auth.reset_password') }}</button>
</div>
</form>
</div>
</div>
</div>

View File

@ -1,20 +1,12 @@
@extends('public')
@section('header-buttons')
@if(!$signedIn)
<a href="{{ baseUrl("/login") }}">@icon('login') {{ trans('auth.log_in') }}</a>
@endif
@stop
@extends('simple-layout')
@section('content')
<div class="text-center">
<div class="card center-box">
<h3>@icon('users') {{ trans('auth.register_thanks') }}</h3>
<div class="body">
<div class="container very-small mt-xl">
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('auth.register_thanks') }}</h1>
<p>{{ trans('auth.register_confirm', ['appName' => setting('app-name')]) }}</p>
</div>
</div>
</div>
@stop

View File

@ -1,16 +1,14 @@
@extends('public')
@section('header-buttons')
<a href="{{ baseUrl("/login") }}">@icon('login') {{ trans('auth.log_in') }}</a>
@stop
@extends('simple-layout')
@section('content')
<div class="container very-small">
<div class="text-center">
<div class="card center-box">
<h3>@icon('new-user') {{ title_case(trans('auth.sign_up')) }}</h3>
<div class="body">
<form action="{{ baseUrl("/register") }}" method="POST">
<div class="my-l">&nbsp;</div>
<div class="card content-wrap">
<h1 class="list-heading">{{ title_case(trans('auth.sign_up')) }}</h1>
<form action="{{ baseUrl("/register") }}" method="POST" class="mt-l stretch-inputs">
{!! csrf_field() !!}
<div class="form-group">
@ -28,23 +26,29 @@
@include('form/password', ['name' => 'password', 'placeholder' => trans('auth.password_hint')])
</div>
<div class="from-group">
<button class="button block pos">{{ trans('auth.create_account') }}</button>
<div class="grid half large-gap v-center mt-m">
<div class="text-small">
<a href="{{ baseUrl('/login') }}">Already have an account?</a>
</div>
<div class="from-group text-right">
<button class="button primary">{{ trans('auth.create_account') }}</button>
</div>
</div>
</form>
@if(count($socialDrivers) > 0)
<hr class="margin-top">
<hr class="my-l">
@foreach($socialDrivers as $driver => $name)
<div>
<a id="social-register-{{$driver}}" class="button block muted-light svg text-left" href="{{ baseUrl("/register/service/" . $driver) }}">
@icon('auth/' . $driver)
{{ trans('auth.sign_up_with', ['socialDriver' => $name]) }}
</a>
</div>
@endforeach
@endif
</div>
</div>
</div>
@stop

View File

@ -1,18 +1,19 @@
@extends('public')
@extends('simple-layout')
@section('content')
<div class="container small">
<p>&nbsp;</p>
<div class="card">
<h3>@icon('users') {{ trans('auth.email_not_confirmed') }}</h3>
<div class="body">
<p class="text-muted">{{ trans('auth.email_not_confirmed_text') }}<br>
{{ trans('auth.email_not_confirmed_click_link') }} <br>
<div class="container very-small mt-xl">
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('auth.email_not_confirmed') }}</h1>
<p>{{ trans('auth.email_not_confirmed_text') }}<br>
{{ trans('auth.email_not_confirmed_click_link') }}
</p>
<p>
{{ trans('auth.email_not_confirmed_resend') }}
</p>
<hr>
<form action="{{ baseUrl("/register/confirm/resend") }}" method="POST">
<form action="{{ baseUrl("/register/confirm/resend") }}" method="POST" class="stretch-inputs">
{!! csrf_field() !!}
<div class="form-group">
<label for="email">{{ trans('auth.email') }}</label>
@ -22,13 +23,12 @@
@include('form/text', ['name' => 'email'])
@endif
</div>
<div class="form-group">
<button type="submit" class="button pos">{{ trans('auth.email_not_confirmed_resend_button') }}</button>
<div class="form-group text-right mt-m">
<button type="submit" class="button primary">{{ trans('auth.email_not_confirmed_resend_button') }}</button>
</div>
</form>
</div>
</div>
</div>
</div>
@stop

View File

@ -1,5 +1,6 @@
<header id="header" header-mobile-toggle>
<div class="grid break-l mx-l">
<div>
<a href="{{ baseUrl('/') }}" class="logo">
@if(setting('app-logo', '') !== 'none')
@ -11,15 +12,20 @@
</a>
<div class="mobile-menu-toggle hide-over-l">@icon('more')</div>
</div>
<div class="header-search hide-under-l">
@if (hasAppAccess())
<form action="{{ baseUrl('/search') }}" method="GET" class="search-box">
<button id="header-search-box-button" type="submit">@icon('search') </button>
<input id="header-search-box-input" type="text" name="term" tabindex="2" placeholder="{{ trans('common.search') }}" value="{{ isset($searchTerm) ? $searchTerm : '' }}">
</form>
@endif
</div>
<div class="text-right">
<div class="header-links">
<div class="links text-center">
@if (hasAppAccess())
<a class="hide-over-l" href="{{ baseUrl('/search') }}">@icon('search'){{ trans('common.search') }}</a>
@if(userCan('bookshelf-view-all') || userCan('bookshelf-view-own'))
<a href="{{ baseUrl('/shelves') }}">@icon('bookshelf'){{ trans('entities.shelves') }}</a>
@ -31,6 +37,8 @@
@if(signedInUser() && userCan('users-manage') && !userCan('settings-manage'))
<a href="{{ baseUrl('/settings/users') }}">@icon('users'){{ trans('settings.users') }}</a>
@endif
@endif
@if(!signedInUser())
@if(setting('registration-enabled', false))
<a href="{{ baseUrl("/register") }}">@icon('new-user') {{ trans('auth.sign_up') }}</a>
@ -60,5 +68,6 @@
@endif
</div>
</div>
</div>
</header>

View File

@ -7,7 +7,7 @@
<a expand-toggle=".entity-list.compact .entity-item-snippet" class="text-muted">@icon('expand-text'){{ trans('common.toggle_details') }}</a>
</div>
<div class="grid contained thirds space-xl break-m" id="home-default">
<div class="grid contained third large-gap" id="home-default">
<div>
@if(count($draftPages) > 0)
<div id="recent-drafts" class="card mb-xl">

View File

@ -1,14 +1,12 @@
@extends('public')
@extends('simple-layout')
@section('content')
<div class="container small">
<div class="card">
<div class="body">
<h4 class="text-muted">@icon('danger') {{ trans('errors.app_down', ['appName' => setting('app-name')]) }}</h4>
<div class="container small mt-xl">
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('errors.app_down', ['appName' => setting('app-name')]) }}</h1>
<p>{{ trans('errors.back_soon') }}</p>
</div>
</div>
</div>
@stop

View File

@ -1,62 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ setting('app-name') }}</title>
<!-- Meta -->
<meta name="viewport" content="width=device-width">
<meta name="token" content="{{ csrf_token() }}">
<meta name="base-url" content="{{ baseUrl('/') }}">
<meta charset="utf-8">
<!-- Styles and Fonts -->
<link rel="stylesheet" href="{{ versioned_asset('dist/styles.css') }}">
<link rel="stylesheet" media="print" href="{{ versioned_asset('dist/print-styles.css') }}">
<!-- Scripts -->
@include('partials/custom-styles')
<!-- Custom user content -->
@if(setting('app-custom-head'))
{!! setting('app-custom-head') !!}
@endif
</head>
<body class="@yield('body-class')">
@include('partials.notifications')
<header id="header">
<div class="container fluid">
<div class="row">
<div class="col-sm-6">
<a href="{{ baseUrl('/') }}" class="logo">
@if(setting('app-logo', '') !== 'none')
<img class="logo-image" src="{{ setting('app-logo', '') === '' ? baseUrl('/logo.png') : baseUrl(setting('app-logo', '')) }}" alt="Logo">
@endif
@if (setting('app-name-header'))
<span class="logo-text">{{ setting('app-name') }}</span>
@endif
</a>
</div>
<div class="col-sm-6">
<div class="float right">
<div class="links text-center">
@yield('header-buttons')
</div>
@if(isset($signedIn) && $signedIn)
@include('partials._header-dropdown', ['currentUser' => $currentUser])
@endif
</div>
</div>
</div>
</div>
</header>
<section class="container">
@yield('content')
</section>
<script src="{{ versioned_asset('dist/app.js') }}"></script>
</body>
</html>

View File

@ -1,3 +1,7 @@
<input type="checkbox" name="permissions[{{ $permission }}]"
@if(old('permissions'.$permission, false)|| (!old('display_name', false) && (isset($role) && $role->hasPermission($permission)))) checked="checked" @endif
value="true">
@include('components.custom-checkbox', [
'name' => 'permissions[' . $permission . ']',
'value' => 'true',
'checked' => old('permissions'.$permission, false)|| (!old('display_name', false) && (isset($role) && $role->hasPermission($permission))),
'label' => $label
])

View File

@ -2,7 +2,7 @@
@section('body')
<div class="container">
<div class="container small">
<div class="py-m">
@include('settings.navbar', ['selected' => 'roles'])

View File

@ -2,7 +2,7 @@
@section('body')
<div class="container">
<div class="container small">
<div class="py-m">
@include('settings.navbar', ['selected' => 'roles'])
</div>

View File

@ -2,9 +2,7 @@
{{--TODO - Add select-all shortcuts--}}
<div class="grid left-focus large-gap">
<div class="card content-wrap fill-width">
<div class="card content-wrap">
<h1 class="list-heading">{{ $title }}</h1>
<div class="setting-list">
@ -16,17 +14,17 @@
<div>
<div class="form-group">
<label for="name">{{ trans('settings.role_name') }}</label>
@include('form/text', ['name' => 'display_name'])
@include('form.text', ['name' => 'display_name'])
</div>
<div class="form-group">
<label for="name">{{ trans('settings.role_desc') }}</label>
@include('form/text', ['name' => 'description'])
@include('form.text', ['name' => 'description'])
</div>
@if(config('auth.method') === 'ldap')
<div class="form-group">
<label for="name">{{ trans('settings.role_external_auth_id') }}</label>
@include('form/text', ['name' => 'external_auth_id'])
@include('form.text', ['name' => 'external_auth_id'])
</div>
@endif
</div>
@ -36,12 +34,12 @@
<div>
<label class="setting-list-label">{{ trans('settings.role_system') }}</label>
</div>
<div>
<label>@include('settings/roles/checkbox', ['permission' => 'users-manage']) {{ trans('settings.role_manage_users') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'user-roles-manage']) {{ trans('settings.role_manage_roles') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'restrictions-manage-all']) {{ trans('settings.role_manage_entity_permissions') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'restrictions-manage-own']) {{ trans('settings.role_manage_own_entity_permissions') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'settings-manage']) {{ trans('settings.role_manage_settings') }}</label>
<div class="toggle-switch-list">
<div>@include('settings.roles.checkbox', ['permission' => 'users-manage', 'label' => trans('settings.role_manage_users')])</div>
<div>@include('settings.roles.checkbox', ['permission' => 'user-roles-manage', 'label' => trans('settings.role_manage_roles')])</div>
<div>@include('settings.roles.checkbox', ['permission' => 'restrictions-manage-all', 'label' => trans('settings.role_manage_entity_permissions')])</div>
<div>@include('settings.roles.checkbox', ['permission' => 'restrictions-manage-own', 'label' => trans('settings.role_manage_own_entity_permissions')])</div>
<div>@include('settings.roles.checkbox', ['permission' => 'settings-manage', 'label' => trans('settings.role_manage_settings')])</div>
</div>
</div>
@ -50,10 +48,10 @@
<p>{{ trans('settings.role_asset_desc') }}</p>
@if (isset($role) && $role->system_name === 'admin')
<p>{{ trans('settings.role_asset_admins') }}</p>
<p class="text-secondary">{{ trans('settings.role_asset_admins') }}</p>
@endif
<table class="table">
<table class="table toggle-switch-list compact">
<tr>
<th width="20%"></th>
<th width="20%">{{ trans('common.create') }}</th>
@ -64,114 +62,134 @@
<tr>
<td>{{ trans('entities.shelves_long') }}</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'bookshelf-create-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'bookshelf-create-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'bookshelf-view-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'bookshelf-view-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'bookshelf-view-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'bookshelf-view-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'bookshelf-update-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'bookshelf-update-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'bookshelf-update-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'bookshelf-update-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'bookshelf-delete-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'bookshelf-delete-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'bookshelf-delete-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'bookshelf-delete-all', 'label' => trans('settings.role_all')])
</td>
</tr>
<tr>
<td>{{ trans('entities.books') }}</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'book-create-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'book-create-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'book-view-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'book-view-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'book-view-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'book-view-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'book-update-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'book-update-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'book-update-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'book-update-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'book-delete-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'book-delete-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'book-delete-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'book-delete-all', 'label' => trans('settings.role_all')])
</td>
</tr>
<tr>
<td>{{ trans('entities.chapters') }}</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'chapter-create-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'chapter-create-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'chapter-create-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'chapter-create-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'chapter-view-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'chapter-view-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'chapter-view-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'chapter-view-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'chapter-update-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'chapter-update-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'chapter-update-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'chapter-update-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'chapter-delete-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'chapter-delete-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'chapter-delete-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'chapter-delete-all', 'label' => trans('settings.role_all')])
</td>
</tr>
<tr>
<td>{{ trans('entities.pages') }}</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'page-create-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'page-create-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'page-create-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'page-create-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'page-view-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'page-view-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'page-view-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'page-view-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'page-update-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'page-update-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'page-update-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'page-update-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'page-delete-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'page-delete-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'page-delete-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'page-delete-all', 'label' => trans('settings.role_all')])
</td>
</tr>
<tr>
<td>{{ trans('entities.images') }}</td>
<td>@include('settings/roles/checkbox', ['permission' => 'image-create-all'])</td>
<td>@include('settings.roles.checkbox', ['permission' => 'image-create-all', 'label' => ''])</td>
<td style="line-height:1.2;"><small class="faded">{{ trans('settings.role_controlled_by_asset') }}</small></td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'image-update-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'image-update-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'image-update-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'image-update-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'image-delete-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'image-delete-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'image-delete-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'image-delete-all', 'label' => trans('settings.role_all')])
</td>
</tr>
<tr>
<td>{{ trans('entities.attachments') }}</td>
<td>@include('settings/roles/checkbox', ['permission' => 'attachment-create-all'])</td>
<td>@include('settings.roles.checkbox', ['permission' => 'attachment-create-all', 'label' => ''])</td>
<td style="line-height:1.2;"><small class="faded">{{ trans('settings.role_controlled_by_asset') }}</small></td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'attachment-update-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'attachment-update-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'attachment-update-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'attachment-update-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'attachment-delete-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'attachment-delete-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'attachment-delete-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'attachment-delete-all', 'label' => trans('settings.role_all')])
</td>
</tr>
<tr>
<td>{{ trans('entities.comments') }}</td>
<td>@include('settings/roles/checkbox', ['permission' => 'comment-create-all'])</td>
<td>@include('settings.roles.checkbox', ['permission' => 'comment-create-all', 'label' => ''])</td>
<td style="line-height:1.2;"><small class="faded">{{ trans('settings.role_controlled_by_asset') }}</small></td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'comment-update-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'comment-update-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'comment-update-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'comment-update-all', 'label' => trans('settings.role_all')])
</td>
<td>
<label>@include('settings/roles/checkbox', ['permission' => 'comment-delete-own']) {{ trans('settings.role_own') }}</label>
<label>@include('settings/roles/checkbox', ['permission' => 'comment-delete-all']) {{ trans('settings.role_all') }}</label>
@include('settings.roles.checkbox', ['permission' => 'comment-delete-own', 'label' => trans('settings.role_own')])
<br>
@include('settings.roles.checkbox', ['permission' => 'comment-delete-all', 'label' => trans('settings.role_all')])
</td>
</tr>
</table>
@ -181,22 +199,23 @@
<div class="form-group text-right">
<a href="{{ baseUrl("/settings/roles") }}" class="button outline">{{ trans('common.cancel') }}</a>
@if (isset($role) && $role->id)
<a href="{{ baseUrl("/settings/roles/delete/{$role->id}") }}" class="button outline">{{ trans('settings.role_delete') }}</a>
<a href="{{ baseUrl("/settings.roles.delete/{$role->id}") }}" class="button outline">{{ trans('settings.role_delete') }}</a>
@endif
<button type="submit" class="button primary">{{ trans('settings.role_save') }}</button>
</div>
</div>
</div>
<div>
<div class="auto-height fill-width px-l">
<div class="card content-wrap auto-height">
<h2 class="list-heading">{{ trans('settings.role_users') }}</h2>
@if(isset($role) && count($role->users) > 0)
<table class="list-table">
<div class="grid third">
@foreach($role->users as $user)
<tr>
<td style="line-height: 0;"><img class="avatar small" src="{{ $user->getAvatar(40) }}" alt="{{ $user->name }}"></td>
<td>
<div class="user-list-item">
<div>
<img class="avatar small" src="{{ $user->getAvatar(40) }}" alt="{{ $user->name }}">
</div>
<div>
@if(userCan('users-manage') || $currentUser->id == $user->id)
<a href="{{ baseUrl("/settings/users/{$user->id}") }}">
@endif
@ -204,15 +223,13 @@
@if(userCan('users-manage') || $currentUser->id == $user->id)
</a>
@endif
</td>
</tr>
</div>
</div>
@endforeach
</table>
</div>
@else
<p class="text-muted">
{{ trans('settings.role_users_none') }}
</p>
@endif
</div>
</div>
</div>

View File

@ -15,7 +15,7 @@
{!! csrf_field() !!}
<div class="setting-list">
@include('users.forms.' . $authMethod)
@include('users.form')
</div>
<div class="form-group text-right">

View File

@ -14,7 +14,7 @@
<input type="hidden" name="_method" value="PUT">
<div class="setting-list">
@include('users.forms.' . $authMethod, ['model' => $user])
@include('users.form', ['model' => $user, 'authMethod' => $authMethod])
<div class="grid half large-gap">
<div>
@ -35,9 +35,12 @@
</div>
</div>
<div class="grid half large-gap">
<div class="grid half large-gap v-center">
<div>
<label for="user-language" class="setting-list-label">{{ trans('settings.users_preferred_language') }}</label>
<p class="small">
{{ trans('settings.users_preferred_language_desc') }}
</p>
</div>
<div>
<select name="setting[language]" id="user-language">

View File

@ -0,0 +1,70 @@
@if($authMethod === 'system' && $user->system_name == 'public')
<p class="mb-none text-secondary">{{ trans('settings.users_system_public') }}</p>
@endif
<div class="pt-m">
<label class="setting-list-label">{{ trans('settings.users_details') }}</label>
@if($authMethod === 'standard')
<p class="small">{{ trans('settings.users_details_desc') }}</p>
@endif
@if($authMethod === 'ldap' || $authMethod === 'system')
<p class="small">{{ trans('settings.users_details_desc_no_email') }}</p>
@endif
<div class="grid half mt-m large-gap">
<div>
<label for="name">{{ trans('auth.name') }}</label>
@include('form.text', ['name' => 'name'])
</div>
<div>
@if($authMethod !== 'ldap' || userCan('users-manage'))
<label for="email">{{ trans('auth.email') }}</label>
@include('form.text', ['name' => 'email'])
@endif
</div>
</div>
</div>
@if($authMethod === 'ldap' && userCan('users-manage'))
<div class="grid half large-gap v-center">
<div>
<label class="setting-list-label">{{ trans('settings.users_external_auth_id') }}</label>
<p class="small">{{ trans('settings.users_external_auth_id_desc') }}</p>
</div>
<div>
@include('form.text', ['name' => 'external_auth_id'])
</div>
</div>
@endif
@if(userCan('users-manage'))
<div>
<label for="role" class="setting-list-label">{{ trans('settings.users_role') }}</label>
<p class="small">{{ trans('settings.users_role_desc') }}</p>
<div class="mt-m">
@include('form/role-checkboxes', ['name' => 'roles', 'roles' => $roles])
</div>
</div>
@endif
@if($authMethod === 'standard')
<div>
<label class="setting-list-label">{{ trans('settings.users_password') }}</label>
<p class="small">{{ trans('settings.users_password_desc') }}</p>
@if(isset($model))
<p class="small">
{{ trans('settings.users_password_warning') }}
</p>
@endif
<div class="grid half mt-m large-gap">
<div>
<label for="password">{{ trans('auth.password') }}</label>
@include('form.password', ['name' => 'password'])
</div>
<div>
<label for="password-confirm">{{ trans('auth.password_confirm') }}</label>
@include('form.password', ['name' => 'password-confirm'])
</div>
</div>
</div>
@endif

View File

@ -1,27 +0,0 @@
{{--TODO--}}
<div class="form-group">
<label for="name">{{ trans('auth.name') }}</label>
@include('form.text', ['name' => 'name'])
</div>
@if(userCan('users-manage'))
<div class="form-group">
<label for="email">{{ trans('auth.email') }}</label>
@include('form.text', ['name' => 'email'])
</div>
@endif
@if(userCan('users-manage'))
<div class="form-group">
<label for="role">{{ trans('settings.users_role') }}</label>
@include('form/role-checkboxes', ['name' => 'roles', 'roles' => $roles])
</div>
@endif
@if(userCan('users-manage'))
<div class="form-group">
<label for="external_auth_id">{{ trans('settings.users_external_auth_id') }}</label>
@include('form.text', ['name' => 'external_auth_id'])
</div>
@endif

View File

@ -1,47 +0,0 @@
<div class="pt-m">
<label class="setting-list-label">{{ trans('settings.users_details') }}</label>
<p class="small">{{ trans('settings.users_details_desc') }}</p>
<div class="grid half mt-m large-gap">
<div>
<label for="name">{{ trans('auth.name') }}</label>
@include('form.text', ['name' => 'name'])
</div>
<div>
<label for="email">{{ trans('auth.email') }}</label>
@include('form.text', ['name' => 'email'])
</div>
</div>
</div>
@if(userCan('users-manage'))
<div>
<label for="role" class="setting-list-label">{{ trans('settings.users_role') }}</label>
<p class="small">{{ trans('settings.users_role_desc') }}</p>
<div class="mt-m">
@include('form/role-checkboxes', ['name' => 'roles', 'roles' => $roles])
</div>
</div>
@endif
<div>
<label class="setting-list-label">{{ trans('settings.users_password') }}</label>
<p class="small">{{ trans('settings.users_password_desc') }}</p>
@if(isset($model))
<p class="small">
{{ trans('settings.users_password_warning') }}
</p>
@endif
<div class="grid half mt-m large-gap">
<div>
<label for="password">{{ trans('auth.password') }}</label>
@include('form.password', ['name' => 'password'])
</div>
<div>
<label for="password-confirm">{{ trans('auth.password_confirm') }}</label>
@include('form.password', ['name' => 'password-confirm'])
</div>
</div>
</div>

View File

@ -1,23 +0,0 @@
{{--TODO--}}
@if($user->system_name == 'public')
<p>{{ trans('settings.users_system_public') }}</p>
@endif
<div class="form-group">
<label for="name">{{ trans('auth.name') }}</label>
@include('form.text', ['name' => 'name'])
</div>
<div class="form-group">
<label for="email">{{ trans('auth.email') }}</label>
@include('form.text', ['name' => 'email'])
</div>
@if(userCan('users-manage'))
<div class="form-group">
<label for="role">{{ trans('settings.users_role') }}</label>
@include('form/role-checkboxes', ['name' => 'roles', 'roles' => $roles])
</div>
@endif