diff --git a/app/Auth/Role.php b/app/Auth/Role.php index c8bb47e45..917d8aa26 100644 --- a/app/Auth/Role.php +++ b/app/Auth/Role.php @@ -1,6 +1,7 @@ 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); } diff --git a/app/Http/Controllers/PermissionController.php b/app/Http/Controllers/PermissionController.php index 9be343c9a..9893d5993 100644 --- a/app/Http/Controllers/PermissionController.php +++ b/app/Http/Controllers/PermissionController.php @@ -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]); } /** diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index c9b2726e8..1a3384367 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -37,7 +37,7 @@ class Authenticate } } - if ($this->auth->guest() && !setting('app-public')) { + if (!hasAppAccess()) { if ($request->ajax()) { return response('Unauthorized.', 401); } else { diff --git a/app/helpers.php b/app/helpers.php index b0886d02b..e1395d816 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -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 diff --git a/resources/assets/sass/_forms.scss b/resources/assets/sass/_forms.scss index 6634ac81b..0b69c0d5b 100644 --- a/resources/assets/sass/_forms.scss +++ b/resources/assets/sass/_forms.scss @@ -176,8 +176,13 @@ input[type=date] { opacity: 0.8; } } -.toggle-switch-list .toggle-switch { - margin: $-xs 0; +.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; } diff --git a/resources/assets/sass/_grid.scss b/resources/assets/sass/_grid.scss index b3d4895a3..31ad84e1e 100644 --- a/resources/assets/sass/_grid.scss +++ b/resources/assets/sass/_grid.scss @@ -200,6 +200,9 @@ div[class^="col-"] img { &.small { max-width: 840px; } + &.very-small { + max-width: 480px; + } &.nopad { padding-left: 0; padding-right: 0; diff --git a/resources/assets/sass/_lists.scss b/resources/assets/sass/_lists.scss index 3392d831c..d12155962 100644 --- a/resources/assets/sass/_lists.scss +++ b/resources/assets/sass/_lists.scss @@ -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; diff --git a/resources/assets/sass/_text.scss b/resources/assets/sass/_text.scss index 972eafddd..539ffef99 100644 --- a/resources/assets/sass/_text.scss +++ b/resources/assets/sass/_text.scss @@ -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 { diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php index eb0d8df07..44ae0c613 100755 --- a/resources/lang/en/settings.php +++ b/resources/lang/en/settings.php @@ -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', diff --git a/resources/views/auth/forms/login/ldap.blade.php b/resources/views/auth/forms/login/ldap.blade.php index b52b5f13e..ecdda6520 100644 --- a/resources/views/auth/forms/login/ldap.blade.php +++ b/resources/views/auth/forms/login/ldap.blade.php @@ -1,12 +1,12 @@