mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Laravel 8 shift squash & merge (#3029)
* Temporarily moved back config path * Apply Laravel coding style * Shift exception handler * Shift HTTP kernel and middleware * Shift service providers * Convert options array to fluent methods * Shift to class based routes * Shift console routes * Ignore temporary framework files * Shift to class based factories * Namespace seeders * Shift PSR-4 autoloading * Shift config files * Default config files * Shift Laravel dependencies * Shift return type of base TestCase methods * Shift cleanup * Applied stylci style changes * Reverted config files location * Applied manual changes to Laravel 8 shift Co-authored-by: Shift <shift@laravelshift.com>
This commit is contained in:
parent
f77236aa38
commit
f139cded78
@ -4,6 +4,7 @@ namespace BookStack\Actions;
|
|||||||
|
|
||||||
use BookStack\Model;
|
use BookStack\Model;
|
||||||
use BookStack\Traits\HasCreatorAndUpdater;
|
use BookStack\Traits\HasCreatorAndUpdater;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,6 +16,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|||||||
*/
|
*/
|
||||||
class Comment extends Model
|
class Comment extends Model
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
use HasCreatorAndUpdater;
|
use HasCreatorAndUpdater;
|
||||||
|
|
||||||
protected $fillable = ['text', 'parent_id'];
|
protected $fillable = ['text', 'parent_id'];
|
||||||
|
@ -3,10 +3,13 @@
|
|||||||
namespace BookStack\Actions;
|
namespace BookStack\Actions;
|
||||||
|
|
||||||
use BookStack\Model;
|
use BookStack\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||||
|
|
||||||
class Tag extends Model
|
class Tag extends Model
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
protected $fillable = ['name', 'value', 'order'];
|
protected $fillable = ['name', 'value', 'order'];
|
||||||
protected $hidden = ['id', 'entity_id', 'entity_type', 'created_at', 'updated_at'];
|
protected $hidden = ['id', 'entity_id', 'entity_type', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ use BookStack\Auth\Permissions\RolePermission;
|
|||||||
use BookStack\Interfaces\Loggable;
|
use BookStack\Interfaces\Loggable;
|
||||||
use BookStack\Model;
|
use BookStack\Model;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
@ -23,6 +24,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
*/
|
*/
|
||||||
class Role extends Model implements Loggable
|
class Role extends Model implements Loggable
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
protected $fillable = ['display_name', 'description', 'external_auth_id'];
|
protected $fillable = ['display_name', 'description', 'external_auth_id'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,7 @@ use Illuminate\Auth\Passwords\CanResetPassword;
|
|||||||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
||||||
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
|
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
@ -43,6 +44,7 @@ use Illuminate\Support\Collection;
|
|||||||
*/
|
*/
|
||||||
class User extends Model implements AuthenticatableContract, CanResetPasswordContract, Loggable, Sluggable
|
class User extends Model implements AuthenticatableContract, CanResetPasswordContract, Loggable, Sluggable
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
use Authenticatable;
|
use Authenticatable;
|
||||||
use CanResetPassword;
|
use CanResetPassword;
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
|
11
app/Config/app.php
Executable file → Normal file
11
app/Config/app.php
Executable file → Normal file
@ -143,7 +143,6 @@ return [
|
|||||||
|
|
||||||
// Class aliases, Registered on application start
|
// Class aliases, Registered on application start
|
||||||
'aliases' => [
|
'aliases' => [
|
||||||
|
|
||||||
// Laravel
|
// Laravel
|
||||||
'App' => Illuminate\Support\Facades\App::class,
|
'App' => Illuminate\Support\Facades\App::class,
|
||||||
'Arr' => Illuminate\Support\Arr::class,
|
'Arr' => Illuminate\Support\Arr::class,
|
||||||
@ -155,21 +154,23 @@ return [
|
|||||||
'Config' => Illuminate\Support\Facades\Config::class,
|
'Config' => Illuminate\Support\Facades\Config::class,
|
||||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||||
|
'Date' => Illuminate\Support\Facades\Date::class,
|
||||||
'DB' => Illuminate\Support\Facades\DB::class,
|
'DB' => Illuminate\Support\Facades\DB::class,
|
||||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
||||||
'Event' => Illuminate\Support\Facades\Event::class,
|
'Event' => Illuminate\Support\Facades\Event::class,
|
||||||
'File' => Illuminate\Support\Facades\File::class,
|
'File' => Illuminate\Support\Facades\File::class,
|
||||||
|
'Gate' => Illuminate\Support\Facades\Gate::class,
|
||||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
'Hash' => Illuminate\Support\Facades\Hash::class,
|
||||||
'Input' => Illuminate\Support\Facades\Input::class,
|
'Http' => Illuminate\Support\Facades\Http::class,
|
||||||
'Inspiring' => Illuminate\Foundation\Inspiring::class,
|
|
||||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||||
'Log' => Illuminate\Support\Facades\Log::class,
|
'Log' => Illuminate\Support\Facades\Log::class,
|
||||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||||
'Notification' => Illuminate\Support\Facades\Notification::class,
|
'Notification' => Illuminate\Support\Facades\Notification::class,
|
||||||
'Password' => Illuminate\Support\Facades\Password::class,
|
'Password' => Illuminate\Support\Facades\Password::class,
|
||||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||||
|
'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
|
||||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||||
'Redis' => Illuminate\Support\Facades\Redis::class,
|
// 'Redis' => Illuminate\Support\Facades\Redis::class,
|
||||||
'Request' => Illuminate\Support\Facades\Request::class,
|
'Request' => Illuminate\Support\Facades\Request::class,
|
||||||
'Response' => Illuminate\Support\Facades\Response::class,
|
'Response' => Illuminate\Support\Facades\Response::class,
|
||||||
'Route' => Illuminate\Support\Facades\Route::class,
|
'Route' => Illuminate\Support\Facades\Route::class,
|
||||||
@ -180,6 +181,8 @@ return [
|
|||||||
'URL' => Illuminate\Support\Facades\URL::class,
|
'URL' => Illuminate\Support\Facades\URL::class,
|
||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
'View' => Illuminate\Support\Facades\View::class,
|
||||||
|
|
||||||
|
// Laravel Packages
|
||||||
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
|
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
|
||||||
|
|
||||||
// Third Party
|
// Third Party
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
// Method of authentication to use
|
|
||||||
// Options: standard, ldap, saml2, oidc
|
// Options: standard, ldap, saml2, oidc
|
||||||
'method' => env('AUTH_METHOD', 'standard'),
|
'method' => env('AUTH_METHOD', 'standard'),
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ return [
|
|||||||
'provider' => 'external',
|
'provider' => 'external',
|
||||||
],
|
],
|
||||||
'api' => [
|
'api' => [
|
||||||
'driver' => 'api-token',
|
'driver' => 'api-token',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -58,10 +57,16 @@ return [
|
|||||||
'driver' => 'eloquent',
|
'driver' => 'eloquent',
|
||||||
'model' => \BookStack\Auth\User::class,
|
'model' => \BookStack\Auth\User::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
'external' => [
|
'external' => [
|
||||||
'driver' => 'external-users',
|
'driver' => 'external-users',
|
||||||
'model' => \BookStack\Auth\User::class,
|
'model' => \BookStack\Auth\User::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// 'users' => [
|
||||||
|
// 'driver' => 'database',
|
||||||
|
// 'table' => 'users',
|
||||||
|
// ],
|
||||||
],
|
],
|
||||||
|
|
||||||
// Resetting Passwords
|
// Resetting Passwords
|
||||||
@ -78,4 +83,10 @@ return [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// Password Confirmation Timeout
|
||||||
|
// Here you may define the amount of seconds before a password confirmation
|
||||||
|
// times out and the user is prompted to re-enter their password via the
|
||||||
|
// confirmation screen. By default, the timeout lasts for three hours.
|
||||||
|
'password_timeout' => 10800,
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -1,51 +1,79 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasting configuration options.
|
* Caching configuration options.
|
||||||
*
|
*
|
||||||
* Changes to these config files are not supported by BookStack and may break upon updates.
|
* Changes to these config files are not supported by BookStack and may break upon updates.
|
||||||
* Configuration should be altered via the `.env` file or environment variables.
|
* Configuration should be altered via the `.env` file or environment variables.
|
||||||
* Do not edit this file unless you're happy to maintain any changes yourself.
|
* Do not edit this file unless you're happy to maintain any changes yourself.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// MEMCACHED - Split out configuration into an array
|
||||||
|
if (env('CACHE_DRIVER') === 'memcached') {
|
||||||
|
$memcachedServerKeys = ['host', 'port', 'weight'];
|
||||||
|
$memcachedServers = explode(',', trim(env('MEMCACHED_SERVERS', '127.0.0.1:11211:100'), ','));
|
||||||
|
foreach ($memcachedServers as $index => $memcachedServer) {
|
||||||
|
$memcachedServerDetails = explode(':', $memcachedServer);
|
||||||
|
if (count($memcachedServerDetails) < 2) {
|
||||||
|
$memcachedServerDetails[] = '11211';
|
||||||
|
}
|
||||||
|
if (count($memcachedServerDetails) < 3) {
|
||||||
|
$memcachedServerDetails[] = '100';
|
||||||
|
}
|
||||||
|
$memcachedServers[$index] = array_combine($memcachedServerKeys, $memcachedServerDetails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
// Default Broadcaster
|
// Default cache store to use
|
||||||
// This option controls the default broadcaster that will be used by the
|
// Can be overridden at cache call-time
|
||||||
// framework when an event needs to be broadcast. This can be set to
|
'default' => env('CACHE_DRIVER', 'file'),
|
||||||
// any of the connections defined in the "connections" array below.
|
|
||||||
'default' => env('BROADCAST_DRIVER', 'pusher'),
|
|
||||||
|
|
||||||
// Broadcast Connections
|
// Available caches stores
|
||||||
// Here you may define all of the broadcast connections that will be used
|
'stores' => [
|
||||||
// to broadcast events to other systems or over websockets. Samples of
|
|
||||||
// each available type of connection are provided inside this array.
|
|
||||||
'connections' => [
|
|
||||||
|
|
||||||
'pusher' => [
|
'apc' => [
|
||||||
'driver' => 'pusher',
|
'driver' => 'apc',
|
||||||
'key' => env('PUSHER_APP_KEY'),
|
],
|
||||||
'secret' => env('PUSHER_APP_SECRET'),
|
|
||||||
'app_id' => env('PUSHER_APP_ID'),
|
'array' => [
|
||||||
'options' => [
|
'driver' => 'array',
|
||||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
'serialize' => false,
|
||||||
'useTLS' => true,
|
],
|
||||||
],
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'table' => 'cache',
|
||||||
|
'connection' => null,
|
||||||
|
'lock_connection' => null,
|
||||||
|
],
|
||||||
|
|
||||||
|
'file' => [
|
||||||
|
'driver' => 'file',
|
||||||
|
'path' => storage_path('framework/cache'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'memcached' => [
|
||||||
|
'driver' => 'memcached',
|
||||||
|
'servers' => env('CACHE_DRIVER') === 'memcached' ? $memcachedServers : [],
|
||||||
|
'options' => [],
|
||||||
],
|
],
|
||||||
|
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'driver' => 'redis',
|
'driver' => 'redis',
|
||||||
'connection' => 'default',
|
'connection' => 'default',
|
||||||
|
'lock_connection' => 'default',
|
||||||
],
|
],
|
||||||
|
|
||||||
'log' => [
|
'octane' => [
|
||||||
'driver' => 'log',
|
'driver' => 'octane',
|
||||||
],
|
|
||||||
|
|
||||||
'null' => [
|
|
||||||
'driver' => 'null',
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// Cache key prefix
|
||||||
|
// Used to prevent collisions in shared cache systems.
|
||||||
|
'prefix' => env('CACHE_PREFIX', 'bookstack_cache'),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -1,36 +1,36 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
use Illuminate\Support\Str;
|
||||||
* Caching configuration options.
|
|
||||||
*
|
|
||||||
* Changes to these config files are not supported by BookStack and may break upon updates.
|
|
||||||
* Configuration should be altered via the `.env` file or environment variables.
|
|
||||||
* Do not edit this file unless you're happy to maintain any changes yourself.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// MEMCACHED - Split out configuration into an array
|
|
||||||
if (env('CACHE_DRIVER') === 'memcached') {
|
|
||||||
$memcachedServerKeys = ['host', 'port', 'weight'];
|
|
||||||
$memcachedServers = explode(',', trim(env('MEMCACHED_SERVERS', '127.0.0.1:11211:100'), ','));
|
|
||||||
foreach ($memcachedServers as $index => $memcachedServer) {
|
|
||||||
$memcachedServerDetails = explode(':', $memcachedServer);
|
|
||||||
if (count($memcachedServerDetails) < 2) {
|
|
||||||
$memcachedServerDetails[] = '11211';
|
|
||||||
}
|
|
||||||
if (count($memcachedServerDetails) < 3) {
|
|
||||||
$memcachedServerDetails[] = '100';
|
|
||||||
}
|
|
||||||
$memcachedServers[$index] = array_combine($memcachedServerKeys, $memcachedServerDetails);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
// Default cache store to use
|
/*
|
||||||
// Can be overridden at cache call-time
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default cache connection that gets used while
|
||||||
|
| using this caching library. This connection is used when another is
|
||||||
|
| not explicitly specified when executing a given caching function.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
'default' => env('CACHE_DRIVER', 'file'),
|
'default' => env('CACHE_DRIVER', 'file'),
|
||||||
|
|
||||||
// Available caches stores
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Stores
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define all of the cache "stores" for your application as
|
||||||
|
| well as their drivers. You may even define multiple stores for the
|
||||||
|
| same cache driver to group types of items stored in your caches.
|
||||||
|
|
|
||||||
|
| Supported drivers: "apc", "array", "database", "file",
|
||||||
|
| "memcached", "redis", "dynamodb", "octane", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
'stores' => [
|
'stores' => [
|
||||||
|
|
||||||
'apc' => [
|
'apc' => [
|
||||||
@ -38,13 +38,15 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'array' => [
|
'array' => [
|
||||||
'driver' => 'array',
|
'driver' => 'array',
|
||||||
|
'serialize' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
'database' => [
|
'database' => [
|
||||||
'driver' => 'database',
|
'driver' => 'database',
|
||||||
'table' => 'cache',
|
'table' => 'cache',
|
||||||
'connection' => null,
|
'connection' => null,
|
||||||
|
'lock_connection' => null,
|
||||||
],
|
],
|
||||||
|
|
||||||
'file' => [
|
'file' => [
|
||||||
@ -53,19 +55,50 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'memcached' => [
|
'memcached' => [
|
||||||
'driver' => 'memcached',
|
'driver' => 'memcached',
|
||||||
|
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||||
|
'sasl' => [
|
||||||
|
env('MEMCACHED_USERNAME'),
|
||||||
|
env('MEMCACHED_PASSWORD'),
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||||
|
],
|
||||||
'servers' => env('CACHE_DRIVER') === 'memcached' ? $memcachedServers : [],
|
'servers' => env('CACHE_DRIVER') === 'memcached' ? $memcachedServers : [],
|
||||||
],
|
],
|
||||||
|
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'driver' => 'redis',
|
'driver' => 'redis',
|
||||||
'connection' => 'default',
|
'connection' => 'default',
|
||||||
|
'lock_connection' => 'default',
|
||||||
|
],
|
||||||
|
|
||||||
|
'dynamodb' => [
|
||||||
|
'driver' => 'dynamodb',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||||
|
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'octane' => [
|
||||||
|
'driver' => 'octane',
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
// Cache key prefix
|
/*
|
||||||
// Used to prevent collisions in shared cache systems.
|
|--------------------------------------------------------------------------
|
||||||
'prefix' => env('CACHE_PREFIX', 'bookstack_cache'),
|
| Cache Key Prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When utilizing a RAM based store such as APC or Memcached, there might
|
||||||
|
| be other applications utilizing the same cache. So, we'll specify a
|
||||||
|
| value to get prefixed to all our keys so we can avoid collisions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -25,9 +25,6 @@ return [
|
|||||||
// file storage service, such as s3, to store publicly accessible assets.
|
// file storage service, such as s3, to store publicly accessible assets.
|
||||||
'url' => env('STORAGE_URL', false),
|
'url' => env('STORAGE_URL', false),
|
||||||
|
|
||||||
// Default Cloud Filesystem Disk
|
|
||||||
'cloud' => 's3',
|
|
||||||
|
|
||||||
// Available filesystem disks
|
// Available filesystem disks
|
||||||
// Only local, local_secure & s3 are supported by BookStack
|
// Only local, local_secure & s3 are supported by BookStack
|
||||||
'disks' => [
|
'disks' => [
|
||||||
@ -35,6 +32,7 @@ return [
|
|||||||
'local' => [
|
'local' => [
|
||||||
'driver' => 'local',
|
'driver' => 'local',
|
||||||
'root' => public_path(),
|
'root' => public_path(),
|
||||||
|
'visibility' => 'public',
|
||||||
],
|
],
|
||||||
|
|
||||||
'local_secure_attachments' => [
|
'local_secure_attachments' => [
|
||||||
@ -45,6 +43,7 @@ return [
|
|||||||
'local_secure_images' => [
|
'local_secure_images' => [
|
||||||
'driver' => 'local',
|
'driver' => 'local',
|
||||||
'root' => storage_path('uploads/images/'),
|
'root' => storage_path('uploads/images/'),
|
||||||
|
'visibility' => 'public',
|
||||||
],
|
],
|
||||||
|
|
||||||
's3' => [
|
's3' => [
|
||||||
@ -59,4 +58,12 @@ return [
|
|||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// Symbolic Links
|
||||||
|
// Here you may configure the symbolic links that will be created when the
|
||||||
|
// `storage:link` Artisan command is executed. The array keys should be
|
||||||
|
// the locations of the links and the values should be their targets.
|
||||||
|
'links' => [
|
||||||
|
public_path('storage') => storage_path('app/public'),
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -49,16 +49,9 @@ return [
|
|||||||
'days' => 7,
|
'days' => 7,
|
||||||
],
|
],
|
||||||
|
|
||||||
'slack' => [
|
|
||||||
'driver' => 'slack',
|
|
||||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
|
||||||
'username' => 'Laravel Log',
|
|
||||||
'emoji' => ':boom:',
|
|
||||||
'level' => 'critical',
|
|
||||||
],
|
|
||||||
|
|
||||||
'stderr' => [
|
'stderr' => [
|
||||||
'driver' => 'monolog',
|
'driver' => 'monolog',
|
||||||
|
'level' => 'debug',
|
||||||
'handler' => StreamHandler::class,
|
'handler' => StreamHandler::class,
|
||||||
'with' => [
|
'with' => [
|
||||||
'stream' => 'php://stderr',
|
'stream' => 'php://stderr',
|
||||||
@ -99,6 +92,10 @@ return [
|
|||||||
'testing' => [
|
'testing' => [
|
||||||
'driver' => 'testing',
|
'driver' => 'testing',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'emergency' => [
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
// Failed Login Message
|
// Failed Login Message
|
||||||
|
@ -22,25 +22,29 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'database' => [
|
'database' => [
|
||||||
'driver' => 'database',
|
'driver' => 'database',
|
||||||
'table' => 'jobs',
|
'table' => 'jobs',
|
||||||
'queue' => 'default',
|
'queue' => 'default',
|
||||||
'retry_after' => 90,
|
'retry_after' => 90,
|
||||||
|
'after_commit' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'driver' => 'redis',
|
'driver' => 'redis',
|
||||||
'connection' => 'default',
|
'connection' => 'default',
|
||||||
'queue' => env('REDIS_QUEUE', 'default'),
|
'queue' => env('REDIS_QUEUE', 'default'),
|
||||||
'retry_after' => 90,
|
'retry_after' => 90,
|
||||||
'block_for' => null,
|
'block_for' => null,
|
||||||
|
'after_commit' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
// Failed queue job logging
|
// Failed queue job logging
|
||||||
'failed' => [
|
'failed' => [
|
||||||
'database' => 'mysql', 'table' => 'failed_jobs',
|
'driver' => 'database-uuids',
|
||||||
|
'database' => 'mysql',
|
||||||
|
'table' => 'failed_jobs',
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -4,6 +4,7 @@ namespace BookStack\Entities\Models;
|
|||||||
|
|
||||||
use BookStack\Uploads\Image;
|
use BookStack\Uploads\Image;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
@ -21,6 +22,8 @@ use Illuminate\Support\Collection;
|
|||||||
*/
|
*/
|
||||||
class Book extends Entity implements HasCoverImage
|
class Book extends Entity implements HasCoverImage
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
public $searchFactor = 2;
|
public $searchFactor = 2;
|
||||||
|
|
||||||
protected $fillable = ['name', 'description'];
|
protected $fillable = ['name', 'description'];
|
||||||
|
@ -3,11 +3,14 @@
|
|||||||
namespace BookStack\Entities\Models;
|
namespace BookStack\Entities\Models;
|
||||||
|
|
||||||
use BookStack\Uploads\Image;
|
use BookStack\Uploads\Image;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
class Bookshelf extends Entity implements HasCoverImage
|
class Bookshelf extends Entity implements HasCoverImage
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'bookshelves';
|
protected $table = 'bookshelves';
|
||||||
|
|
||||||
public $searchFactor = 3;
|
public $searchFactor = 3;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace BookStack\Entities\Models;
|
namespace BookStack\Entities\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,6 +13,8 @@ use Illuminate\Support\Collection;
|
|||||||
*/
|
*/
|
||||||
class Chapter extends BookChild
|
class Chapter extends BookChild
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
public $searchFactor = 1.3;
|
public $searchFactor = 1.3;
|
||||||
|
|
||||||
protected $fillable = ['name', 'description', 'priority', 'book_id'];
|
protected $fillable = ['name', 'description', 'priority', 'book_id'];
|
||||||
|
@ -6,6 +6,7 @@ use BookStack\Entities\Tools\PageContent;
|
|||||||
use BookStack\Uploads\Attachment;
|
use BookStack\Uploads\Attachment;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Permissions;
|
use Permissions;
|
||||||
@ -25,6 +26,8 @@ use Permissions;
|
|||||||
*/
|
*/
|
||||||
class Page extends BookChild
|
class Page extends BookChild
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
public static $listAttributes = ['name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', 'template', 'text', 'created_at', 'updated_at', 'priority'];
|
public static $listAttributes = ['name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', 'template', 'text', 'created_at', 'updated_at', 'priority'];
|
||||||
public static $contentAttributes = ['name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', 'template', 'html', 'text', 'created_at', 'updated_at', 'priority'];
|
public static $contentAttributes = ['name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', 'template', 'html', 'text', 'created_at', 'updated_at', 'priority'];
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class Handler extends ExceptionHandler
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $dontFlash = [
|
protected $dontFlash = [
|
||||||
|
'current_password',
|
||||||
'password',
|
'password',
|
||||||
'password_confirmation',
|
'password_confirmation',
|
||||||
];
|
];
|
||||||
|
@ -11,7 +11,7 @@ class Kernel extends HttpKernel
|
|||||||
* These middleware are run during every request to your application.
|
* These middleware are run during every request to your application.
|
||||||
*/
|
*/
|
||||||
protected $middleware = [
|
protected $middleware = [
|
||||||
\BookStack\Http\Middleware\CheckForMaintenanceMode::class,
|
\BookStack\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||||
\BookStack\Http\Middleware\TrimStrings::class,
|
\BookStack\Http\Middleware\TrimStrings::class,
|
||||||
\BookStack\Http\Middleware\TrustProxies::class,
|
\BookStack\Http\Middleware\TrustProxies::class,
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace BookStack\Http\Middleware;
|
namespace BookStack\Http\Middleware;
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
|
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||||
|
|
||||||
class CheckForMaintenanceMode extends Middleware
|
class PreventRequestsDuringMaintenance extends Middleware
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The URIs that should be reachable while maintenance mode is enabled.
|
* The URIs that should be reachable while maintenance mode is enabled.
|
@ -2,45 +2,31 @@
|
|||||||
|
|
||||||
namespace BookStack\Http\Middleware;
|
namespace BookStack\Http\Middleware;
|
||||||
|
|
||||||
|
use BookStack\Providers\RouteServiceProvider;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class RedirectIfAuthenticated
|
class RedirectIfAuthenticated
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The Guard implementation.
|
|
||||||
*
|
|
||||||
* @var Guard
|
|
||||||
*/
|
|
||||||
protected $auth;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new filter instance.
|
|
||||||
*
|
|
||||||
* @param Guard $auth
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct(Guard $auth)
|
|
||||||
{
|
|
||||||
$this->auth = $auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
* @param \Closure $next
|
||||||
*
|
* @param string|null ...$guards
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle(Request $request, Closure $next, ...$guards)
|
||||||
{
|
{
|
||||||
$requireConfirmation = setting('registration-confirmation');
|
$guards = empty($guards) ? [null] : $guards;
|
||||||
if ($this->auth->check() && (!$requireConfirmation || ($requireConfirmation && $this->auth->user()->email_confirmed))) {
|
|
||||||
return redirect('/');
|
foreach ($guards as $guard) {
|
||||||
|
if (Auth::guard($guard)->check()) {
|
||||||
|
return redirect(RouteServiceProvider::HOME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace BookStack\Http\Middleware;
|
||||||
|
|
||||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace BookStack\Http\Middleware;
|
namespace BookStack\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class TrustProxies extends Middleware
|
class TrustProxies extends Middleware
|
||||||
@ -20,7 +20,7 @@ class TrustProxies extends Middleware
|
|||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the request, Set the correct user-configured proxy information.
|
* Handle the request, Set the correct user-configured proxy information.
|
||||||
|
@ -16,6 +16,7 @@ use BookStack\Util\CspService;
|
|||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Illuminate\Contracts\Cache\Repository;
|
use Illuminate\Contracts\Cache\Repository;
|
||||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||||
|
use Illuminate\Pagination\Paginator;
|
||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\Facades\URL;
|
use Illuminate\Support\Facades\URL;
|
||||||
@ -60,6 +61,9 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
// View Composers
|
// View Composers
|
||||||
View::composer('entities.breadcrumbs', BreadcrumbsViewComposer::class);
|
View::composer('entities.breadcrumbs', BreadcrumbsViewComposer::class);
|
||||||
|
|
||||||
|
// Set paginator to use bootstrap-style pagination
|
||||||
|
Paginator::useBootstrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,6 +30,5 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
parent::boot();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,23 @@
|
|||||||
|
|
||||||
namespace BookStack\Providers;
|
namespace BookStack\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The path to the "home" route for your application.
|
||||||
|
*
|
||||||
|
* This is used by Laravel authentication to redirect users after login.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const HOME = '/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This namespace is applied to the controller routes in your routes file.
|
* This namespace is applied to the controller routes in your routes file.
|
||||||
*
|
*
|
||||||
@ -14,7 +26,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $namespace = 'BookStack\Http\Controllers';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define your route model bindings, pattern filters, etc.
|
* Define your route model bindings, pattern filters, etc.
|
||||||
@ -23,18 +34,12 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
parent::boot();
|
$this->configureRateLimiting();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$this->routes(function () {
|
||||||
* Define the routes for the application.
|
$this->mapWebRoutes();
|
||||||
*
|
$this->mapApiRoutes();
|
||||||
* @return void
|
});
|
||||||
*/
|
|
||||||
public function map()
|
|
||||||
{
|
|
||||||
$this->mapWebRoutes();
|
|
||||||
$this->mapApiRoutes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,4 +76,16 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
require base_path('routes/api.php');
|
require base_path('routes/api.php');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the rate limiters for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function configureRateLimiting()
|
||||||
|
{
|
||||||
|
RateLimiter::for('api', function (Request $request) {
|
||||||
|
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ namespace BookStack\Uploads;
|
|||||||
use BookStack\Entities\Models\Page;
|
use BookStack\Entities\Models\Page;
|
||||||
use BookStack\Model;
|
use BookStack\Model;
|
||||||
use BookStack\Traits\HasCreatorAndUpdater;
|
use BookStack\Traits\HasCreatorAndUpdater;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
@ -18,6 +19,7 @@ use BookStack\Traits\HasCreatorAndUpdater;
|
|||||||
*/
|
*/
|
||||||
class Image extends Model
|
class Image extends Model
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
use HasCreatorAndUpdater;
|
use HasCreatorAndUpdater;
|
||||||
|
|
||||||
protected $fillable = ['name'];
|
protected $fillable = ['name'];
|
||||||
|
@ -20,11 +20,13 @@
|
|||||||
"barryvdh/laravel-dompdf": "^0.9.0",
|
"barryvdh/laravel-dompdf": "^0.9.0",
|
||||||
"barryvdh/laravel-snappy": "^0.4.8",
|
"barryvdh/laravel-snappy": "^0.4.8",
|
||||||
"doctrine/dbal": "^3.1",
|
"doctrine/dbal": "^3.1",
|
||||||
"fideloper/proxy": "^4.4.1",
|
|
||||||
"filp/whoops": "^2.14",
|
"filp/whoops": "^2.14",
|
||||||
|
"guzzlehttp/guzzle": "^7.4",
|
||||||
"intervention/image": "^2.7",
|
"intervention/image": "^2.7",
|
||||||
"laravel/framework": "^7.29",
|
"laravel/framework": "^8.68",
|
||||||
"laravel/socialite": "^5.2",
|
"laravel/socialite": "^5.2",
|
||||||
|
"laravel/tinker": "^2.5",
|
||||||
|
"laravel/ui": "^3.3",
|
||||||
"league/commonmark": "^1.5",
|
"league/commonmark": "^1.5",
|
||||||
"league/flysystem-aws-s3-v3": "^1.0.29",
|
"league/flysystem-aws-s3-v3": "^1.0.29",
|
||||||
"league/html-to-markdown": "^5.0.0",
|
"league/html-to-markdown": "^5.0.0",
|
||||||
@ -32,33 +34,28 @@
|
|||||||
"onelogin/php-saml": "^4.0",
|
"onelogin/php-saml": "^4.0",
|
||||||
"phpseclib/phpseclib": "~3.0",
|
"phpseclib/phpseclib": "~3.0",
|
||||||
"pragmarx/google2fa": "^8.0",
|
"pragmarx/google2fa": "^8.0",
|
||||||
"predis/predis": "^1.1.6",
|
"predis/predis": "^1.1",
|
||||||
"socialiteproviders/discord": "^4.1",
|
"socialiteproviders/discord": "^4.1",
|
||||||
"socialiteproviders/gitlab": "^4.1",
|
"socialiteproviders/gitlab": "^4.1",
|
||||||
"socialiteproviders/microsoft-azure": "^4.1",
|
"socialiteproviders/microsoft-azure": "^4.1",
|
||||||
"socialiteproviders/okta": "^4.1",
|
"socialiteproviders/okta": "^4.1",
|
||||||
"socialiteproviders/slack": "^4.1",
|
"socialiteproviders/slack": "^4.1",
|
||||||
"socialiteproviders/twitch": "^5.3",
|
"socialiteproviders/twitch": "^5.3",
|
||||||
"ssddanbrown/htmldiff": "^1.0.1",
|
"ssddanbrown/htmldiff": "^1.0.1"
|
||||||
"laravel/ui": "^2.5",
|
|
||||||
"guzzlehttp/guzzle": "^7.4.0",
|
|
||||||
"laravel/tinker": "^2.5"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"barryvdh/laravel-debugbar": "^3.6",
|
"barryvdh/laravel-debugbar": "^3.6",
|
||||||
"fakerphp/faker": "^1.13.0",
|
"fakerphp/faker": "^1.13.0",
|
||||||
"mockery/mockery": "^1.3.3",
|
"mockery/mockery": "^1.4.2",
|
||||||
"phpunit/phpunit": "^9.5.3",
|
"phpunit/phpunit": "^9.5.3",
|
||||||
"symfony/dom-crawler": "^5.3",
|
"symfony/dom-crawler": "^5.3",
|
||||||
"nunomaduro/collision": "^4.3"
|
"nunomaduro/collision": "^5.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
|
||||||
"database/seeds",
|
|
||||||
"database/factories"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"BookStack\\": "app/"
|
"BookStack\\": "app/",
|
||||||
|
"Database\\Factories\\": "database/factories/",
|
||||||
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"app/helpers.php"
|
"app/helpers.php"
|
||||||
@ -70,6 +67,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
"post-root-package-install": [
|
"post-root-package-install": [
|
||||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
],
|
],
|
||||||
@ -83,10 +84,6 @@
|
|||||||
"@php artisan cache:clear",
|
"@php artisan cache:clear",
|
||||||
"@php artisan view:clear"
|
"@php artisan view:clear"
|
||||||
],
|
],
|
||||||
"post-autoload-dump": [
|
|
||||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
|
||||||
"@php artisan package:discover --ansi"
|
|
||||||
],
|
|
||||||
"refresh-test-database": [
|
"refresh-test-database": [
|
||||||
"@php artisan migrate:refresh --database=mysql_testing",
|
"@php artisan migrate:refresh --database=mysql_testing",
|
||||||
"@php artisan db:seed --class=DummyContentSeeder --database=mysql_testing"
|
"@php artisan db:seed --class=DummyContentSeeder --database=mysql_testing"
|
||||||
|
629
composer.lock
generated
629
composer.lock
generated
File diff suppressed because it is too large
Load Diff
32
database/factories/Actions/CommentFactory.php
Normal file
32
database/factories/Actions/CommentFactory.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Actions;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
class CommentFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = \BookStack\Actions\Comment::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
$text = $this->faker->paragraph(1);
|
||||||
|
$html = '<p>' . $text . '</p>';
|
||||||
|
|
||||||
|
return [
|
||||||
|
'html' => $html,
|
||||||
|
'text' => $text,
|
||||||
|
'parent_id' => null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
28
database/factories/Actions/TagFactory.php
Normal file
28
database/factories/Actions/TagFactory.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Actions;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
class TagFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = \BookStack\Actions\Tag::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->faker->city,
|
||||||
|
'value' => $this->faker->sentence(3),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
28
database/factories/Auth/RoleFactory.php
Normal file
28
database/factories/Auth/RoleFactory.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
class RoleFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = \BookStack\Auth\Role::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'display_name' => $this->faker->sentence(3),
|
||||||
|
'description' => $this->faker->sentence(10),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
35
database/factories/Auth/UserFactory.php
Normal file
35
database/factories/Auth/UserFactory.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class UserFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = \BookStack\Auth\User::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
$name = $this->faker->name;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => $name,
|
||||||
|
'email' => $this->faker->email,
|
||||||
|
'slug' => \Illuminate\Support\Str::slug($name . '-' . \Illuminate\Support\Str::random(5)),
|
||||||
|
'password' => Str::random(10),
|
||||||
|
'remember_token' => Str::random(10),
|
||||||
|
'email_confirmed' => 1,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
30
database/factories/Entities/Models/BookFactory.php
Normal file
30
database/factories/Entities/Models/BookFactory.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Entities\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class BookFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = \BookStack\Entities\Models\Book::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->faker->sentence,
|
||||||
|
'slug' => Str::random(10),
|
||||||
|
'description' => $this->faker->paragraph,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
30
database/factories/Entities/Models/BookshelfFactory.php
Normal file
30
database/factories/Entities/Models/BookshelfFactory.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Entities\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class BookshelfFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = \BookStack\Entities\Models\Bookshelf::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->faker->sentence,
|
||||||
|
'slug' => Str::random(10),
|
||||||
|
'description' => $this->faker->paragraph,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
30
database/factories/Entities/Models/ChapterFactory.php
Normal file
30
database/factories/Entities/Models/ChapterFactory.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Entities\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class ChapterFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = \BookStack\Entities\Models\Chapter::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->faker->sentence,
|
||||||
|
'slug' => Str::random(10),
|
||||||
|
'description' => $this->faker->paragraph,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
34
database/factories/Entities/Models/PageFactory.php
Normal file
34
database/factories/Entities/Models/PageFactory.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Entities\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class PageFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = \BookStack\Entities\Models\Page::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
$html = '<p>' . implode('</p>', $this->faker->paragraphs(5)) . '</p>';
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => $this->faker->sentence,
|
||||||
|
'slug' => Str::random(10),
|
||||||
|
'html' => $html,
|
||||||
|
'text' => strip_tags($html),
|
||||||
|
'revision_count' => 1,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -1,96 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Model Factories
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may define all of your model factories. Model factories give
|
|
||||||
| you a convenient way to create models for testing and seeding your
|
|
||||||
| database. Just tell the factory how a default model should look.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$factory->define(\BookStack\Auth\User::class, function ($faker) {
|
|
||||||
$name = $faker->name;
|
|
||||||
|
|
||||||
return [
|
|
||||||
'name' => $name,
|
|
||||||
'email' => $faker->email,
|
|
||||||
'slug' => \Illuminate\Support\Str::slug($name . '-' . \Illuminate\Support\Str::random(5)),
|
|
||||||
'password' => Str::random(10),
|
|
||||||
'remember_token' => Str::random(10),
|
|
||||||
'email_confirmed' => 1,
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
$factory->define(\BookStack\Entities\Models\Bookshelf::class, function ($faker) {
|
|
||||||
return [
|
|
||||||
'name' => $faker->sentence,
|
|
||||||
'slug' => Str::random(10),
|
|
||||||
'description' => $faker->paragraph,
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
$factory->define(\BookStack\Entities\Models\Book::class, function ($faker) {
|
|
||||||
return [
|
|
||||||
'name' => $faker->sentence,
|
|
||||||
'slug' => Str::random(10),
|
|
||||||
'description' => $faker->paragraph,
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
$factory->define(\BookStack\Entities\Models\Chapter::class, function ($faker) {
|
|
||||||
return [
|
|
||||||
'name' => $faker->sentence,
|
|
||||||
'slug' => Str::random(10),
|
|
||||||
'description' => $faker->paragraph,
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
$factory->define(\BookStack\Entities\Models\Page::class, function ($faker) {
|
|
||||||
$html = '<p>' . implode('</p>', $faker->paragraphs(5)) . '</p>';
|
|
||||||
|
|
||||||
return [
|
|
||||||
'name' => $faker->sentence,
|
|
||||||
'slug' => Str::random(10),
|
|
||||||
'html' => $html,
|
|
||||||
'text' => strip_tags($html),
|
|
||||||
'revision_count' => 1,
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
$factory->define(\BookStack\Auth\Role::class, function ($faker) {
|
|
||||||
return [
|
|
||||||
'display_name' => $faker->sentence(3),
|
|
||||||
'description' => $faker->sentence(10),
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
$factory->define(\BookStack\Actions\Tag::class, function ($faker) {
|
|
||||||
return [
|
|
||||||
'name' => $faker->city,
|
|
||||||
'value' => $faker->sentence(3),
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
$factory->define(\BookStack\Uploads\Image::class, function ($faker) {
|
|
||||||
return [
|
|
||||||
'name' => $faker->slug . '.jpg',
|
|
||||||
'url' => $faker->url,
|
|
||||||
'path' => $faker->url,
|
|
||||||
'type' => 'gallery',
|
|
||||||
'uploaded_to' => 0,
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
$factory->define(\BookStack\Actions\Comment::class, function ($faker) {
|
|
||||||
$text = $faker->paragraph(1);
|
|
||||||
$html = '<p>' . $text . '</p>';
|
|
||||||
|
|
||||||
return [
|
|
||||||
'html' => $html,
|
|
||||||
'text' => $text,
|
|
||||||
'parent_id' => null,
|
|
||||||
];
|
|
||||||
});
|
|
31
database/factories/Uploads/ImageFactory.php
Normal file
31
database/factories/Uploads/ImageFactory.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Uploads;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
class ImageFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = \BookStack\Uploads\Image::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->faker->slug . '.jpg',
|
||||||
|
'url' => $this->faker->url,
|
||||||
|
'path' => $this->faker->url,
|
||||||
|
'type' => 'gallery',
|
||||||
|
'uploaded_to' => 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use BookStack\Api\ApiToken;
|
use BookStack\Api\ApiToken;
|
||||||
use BookStack\Auth\Permissions\PermissionService;
|
use BookStack\Auth\Permissions\PermissionService;
|
||||||
use BookStack\Auth\Permissions\RolePermission;
|
use BookStack\Auth\Permissions\RolePermission;
|
||||||
@ -10,6 +12,7 @@ use BookStack\Entities\Models\Chapter;
|
|||||||
use BookStack\Entities\Models\Page;
|
use BookStack\Entities\Models\Page;
|
||||||
use BookStack\Entities\Tools\SearchIndex;
|
use BookStack\Entities\Tools\SearchIndex;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class DummyContentSeeder extends Seeder
|
class DummyContentSeeder extends Seeder
|
||||||
@ -22,36 +25,36 @@ class DummyContentSeeder extends Seeder
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
// Create an editor user
|
// Create an editor user
|
||||||
$editorUser = factory(User::class)->create();
|
$editorUser = User::factory()->create();
|
||||||
$editorRole = Role::getRole('editor');
|
$editorRole = Role::getRole('editor');
|
||||||
$editorUser->attachRole($editorRole);
|
$editorUser->attachRole($editorRole);
|
||||||
|
|
||||||
// Create a viewer user
|
// Create a viewer user
|
||||||
$viewerUser = factory(User::class)->create();
|
$viewerUser = User::factory()->create();
|
||||||
$role = Role::getRole('viewer');
|
$role = Role::getRole('viewer');
|
||||||
$viewerUser->attachRole($role);
|
$viewerUser->attachRole($role);
|
||||||
|
|
||||||
$byData = ['created_by' => $editorUser->id, 'updated_by' => $editorUser->id, 'owned_by' => $editorUser->id];
|
$byData = ['created_by' => $editorUser->id, 'updated_by' => $editorUser->id, 'owned_by' => $editorUser->id];
|
||||||
|
|
||||||
factory(\BookStack\Entities\Models\Book::class, 5)->create($byData)
|
\BookStack\Entities\Models\Book::factory()->count(5)->create($byData)
|
||||||
->each(function ($book) use ($byData) {
|
->each(function ($book) use ($byData) {
|
||||||
$chapters = factory(Chapter::class, 3)->create($byData)
|
$chapters = Chapter::factory()->count(3)->create($byData)
|
||||||
->each(function ($chapter) use ($book, $byData) {
|
->each(function ($chapter) use ($book, $byData) {
|
||||||
$pages = factory(Page::class, 3)->make(array_merge($byData, ['book_id' => $book->id]));
|
$pages = Page::factory()->count(3)->make(array_merge($byData, ['book_id' => $book->id]));
|
||||||
$chapter->pages()->saveMany($pages);
|
$chapter->pages()->saveMany($pages);
|
||||||
});
|
});
|
||||||
$pages = factory(Page::class, 3)->make($byData);
|
$pages = Page::factory()->count(3)->make($byData);
|
||||||
$book->chapters()->saveMany($chapters);
|
$book->chapters()->saveMany($chapters);
|
||||||
$book->pages()->saveMany($pages);
|
$book->pages()->saveMany($pages);
|
||||||
});
|
});
|
||||||
|
|
||||||
$largeBook = factory(\BookStack\Entities\Models\Book::class)->create(array_merge($byData, ['name' => 'Large book' . Str::random(10)]));
|
$largeBook = \BookStack\Entities\Models\Book::factory()->create(array_merge($byData, ['name' => 'Large book' . Str::random(10)]));
|
||||||
$pages = factory(Page::class, 200)->make($byData);
|
$pages = Page::factory()->count(200)->make($byData);
|
||||||
$chapters = factory(Chapter::class, 50)->make($byData);
|
$chapters = Chapter::factory()->count(50)->make($byData);
|
||||||
$largeBook->pages()->saveMany($pages);
|
$largeBook->pages()->saveMany($pages);
|
||||||
$largeBook->chapters()->saveMany($chapters);
|
$largeBook->chapters()->saveMany($chapters);
|
||||||
|
|
||||||
$shelves = factory(Bookshelf::class, 10)->create($byData);
|
$shelves = Bookshelf::factory()->count(10)->create($byData);
|
||||||
$largeBook->shelves()->attach($shelves->pluck('id'));
|
$largeBook->shelves()->attach($shelves->pluck('id'));
|
||||||
|
|
||||||
// Assign API permission to editor role and create an API key
|
// Assign API permission to editor role and create an API key
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use BookStack\Auth\Permissions\PermissionService;
|
use BookStack\Auth\Permissions\PermissionService;
|
||||||
use BookStack\Auth\Role;
|
use BookStack\Auth\Role;
|
||||||
use BookStack\Auth\User;
|
use BookStack\Auth\User;
|
||||||
@ -19,13 +21,13 @@ class LargeContentSeeder extends Seeder
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
// Create an editor user
|
// Create an editor user
|
||||||
$editorUser = factory(User::class)->create();
|
$editorUser = User::factory()->create();
|
||||||
$editorRole = Role::getRole('editor');
|
$editorRole = Role::getRole('editor');
|
||||||
$editorUser->attachRole($editorRole);
|
$editorUser->attachRole($editorRole);
|
||||||
|
|
||||||
$largeBook = factory(\BookStack\Entities\Models\Book::class)->create(['name' => 'Large book' . Str::random(10), 'created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
|
$largeBook = \BookStack\Entities\Models\Book::factory()->create(['name' => 'Large book' . Str::random(10), 'created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
|
||||||
$pages = factory(Page::class, 200)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
|
$pages = Page::factory()->count(200)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
|
||||||
$chapters = factory(Chapter::class, 50)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
|
$chapters = Chapter::factory()->count(50)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
|
||||||
$largeBook->pages()->saveMany($pages);
|
$largeBook->pages()->saveMany($pages);
|
||||||
$largeBook->chapters()->saveMany($chapters);
|
$largeBook->chapters()->saveMany($chapters);
|
||||||
app(PermissionService::class)->buildJointPermissions();
|
app(PermissionService::class)->buildJointPermissions();
|
@ -1,21 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
use Illuminate\Contracts\Http\Kernel;
|
||||||
* Laravel - A PHP Framework For Web Artisans.
|
use BookStack\Http\Request;
|
||||||
*
|
|
||||||
* @author Taylor Otwell <taylor@laravel.com>
|
|
||||||
*/
|
|
||||||
define('LARAVEL_START', microtime(true));
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Check If The Application Is Under Maintenance
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If the application is in maintenance / demo mode via the "down" command
|
||||||
|
| we will load this file so that any pre-rendered content can be shown
|
||||||
|
| instead of starting the framework, which could cause an exception.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) {
|
||||||
|
require __DIR__ . '/../storage/framework/maintenance.php';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Register The Auto Loader
|
| Register The Auto Loader
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Composer provides a convenient, automatically generated class loader for
|
| Composer provides a convenient, automatically generated class loader for
|
||||||
| our application. We just need to utilize it! We'll simply require it
|
| this application. We just need to utilize it! We'll simply require it
|
||||||
| into the script here so that we don't have to worry about manual
|
| into the script here so we don't need to manually load our classes.
|
||||||
| loading any of our classes later on. It feels great to relax.
|
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -23,37 +35,22 @@ require __DIR__ . '/../vendor/autoload.php';
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Turn On The Lights
|
| Run The Application
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| We need to illuminate PHP development, so let us turn on the lights.
|
| Once we have the application, we can handle the incoming request using
|
||||||
| This bootstraps the framework and gets it ready for use, then it
|
| the application's HTTP kernel. Then, we will send the response back
|
||||||
| will load up this application so that we can run it and send
|
| to this client's browser, allowing them to enjoy our application.
|
||||||
| the responses back to the browser and delight our users.
|
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$app = require_once __DIR__ . '/../bootstrap/app.php';
|
$app = require_once __DIR__ . '/../bootstrap/app.php';
|
||||||
$app->alias('request', \BookStack\Http\Request::class);
|
$app->alias('request', Request::class);
|
||||||
|
|
||||||
/*
|
$kernel = $app->make(Kernel::class);
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Run The Application
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Once we have the application, we can handle the incoming request
|
|
||||||
| through the kernel, and send the associated response back to
|
|
||||||
| the client's browser allowing them to enjoy the creative
|
|
||||||
| and wonderful application we have prepared for them.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
|
$response = tap($kernel->handle(
|
||||||
|
$request = Request::capture()
|
||||||
|
))->send();
|
||||||
|
|
||||||
$response = $kernel->handle(
|
$kernel->terminate($request, $response);
|
||||||
$request = \BookStack\Http\Request::capture()
|
|
||||||
);
|
|
||||||
|
|
||||||
$response->send();
|
|
||||||
|
|
||||||
$kernel->terminate($request, $response);
|
|
@ -1,53 +1,64 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use BookStack\Http\Controllers\Api\ApiDocsController;
|
||||||
|
use BookStack\Http\Controllers\Api\AttachmentApiController;
|
||||||
|
use BookStack\Http\Controllers\Api\BookApiController;
|
||||||
|
use BookStack\Http\Controllers\Api\BookExportApiController;
|
||||||
|
use BookStack\Http\Controllers\Api\BookshelfApiController;
|
||||||
|
use BookStack\Http\Controllers\Api\ChapterApiController;
|
||||||
|
use BookStack\Http\Controllers\Api\ChapterExportApiController;
|
||||||
|
use BookStack\Http\Controllers\Api\PageApiController;
|
||||||
|
use BookStack\Http\Controllers\Api\PageExportApiController;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Routes for the BookStack API.
|
* Routes for the BookStack API.
|
||||||
* Routes have a uri prefix of /api/.
|
* Routes have a uri prefix of /api/.
|
||||||
* Controllers are all within app/Http/Controllers/Api.
|
* Controllers are all within app/Http/Controllers/Api.
|
||||||
*/
|
*/
|
||||||
Route::get('docs.json', 'ApiDocsController@json');
|
Route::get('docs.json', [ApiDocsController::class, 'json']);
|
||||||
|
|
||||||
Route::get('attachments', 'AttachmentApiController@list');
|
Route::get('attachments', [AttachmentApiController::class, 'list']);
|
||||||
Route::post('attachments', 'AttachmentApiController@create');
|
Route::post('attachments', [AttachmentApiController::class, 'create']);
|
||||||
Route::get('attachments/{id}', 'AttachmentApiController@read');
|
Route::get('attachments/{id}', [AttachmentApiController::class, 'read']);
|
||||||
Route::put('attachments/{id}', 'AttachmentApiController@update');
|
Route::put('attachments/{id}', [AttachmentApiController::class, 'update']);
|
||||||
Route::delete('attachments/{id}', 'AttachmentApiController@delete');
|
Route::delete('attachments/{id}', [AttachmentApiController::class, 'delete']);
|
||||||
|
|
||||||
Route::get('books', 'BookApiController@list');
|
Route::get('books', [BookApiController::class, 'list']);
|
||||||
Route::post('books', 'BookApiController@create');
|
Route::post('books', [BookApiController::class, 'create']);
|
||||||
Route::get('books/{id}', 'BookApiController@read');
|
Route::get('books/{id}', [BookApiController::class, 'read']);
|
||||||
Route::put('books/{id}', 'BookApiController@update');
|
Route::put('books/{id}', [BookApiController::class, 'update']);
|
||||||
Route::delete('books/{id}', 'BookApiController@delete');
|
Route::delete('books/{id}', [BookApiController::class, 'delete']);
|
||||||
|
|
||||||
Route::get('books/{id}/export/html', 'BookExportApiController@exportHtml');
|
Route::get('books/{id}/export/html', [BookExportApiController::class, 'exportHtml']);
|
||||||
Route::get('books/{id}/export/pdf', 'BookExportApiController@exportPdf');
|
Route::get('books/{id}/export/pdf', [BookExportApiController::class, 'exportPdf']);
|
||||||
Route::get('books/{id}/export/plaintext', 'BookExportApiController@exportPlainText');
|
Route::get('books/{id}/export/plaintext', [BookExportApiController::class, 'exportPlainText']);
|
||||||
Route::get('books/{id}/export/markdown', 'BookExportApiController@exportMarkdown');
|
Route::get('books/{id}/export/markdown', [BookExportApiController::class, 'exportMarkdown']);
|
||||||
|
|
||||||
Route::get('chapters', 'ChapterApiController@list');
|
Route::get('chapters', [ChapterApiController::class, 'list']);
|
||||||
Route::post('chapters', 'ChapterApiController@create');
|
Route::post('chapters', [ChapterApiController::class, 'create']);
|
||||||
Route::get('chapters/{id}', 'ChapterApiController@read');
|
Route::get('chapters/{id}', [ChapterApiController::class, 'read']);
|
||||||
Route::put('chapters/{id}', 'ChapterApiController@update');
|
Route::put('chapters/{id}', [ChapterApiController::class, 'update']);
|
||||||
Route::delete('chapters/{id}', 'ChapterApiController@delete');
|
Route::delete('chapters/{id}', [ChapterApiController::class, 'delete']);
|
||||||
|
|
||||||
Route::get('chapters/{id}/export/html', 'ChapterExportApiController@exportHtml');
|
Route::get('chapters/{id}/export/html', [ChapterExportApiController::class, 'exportHtml']);
|
||||||
Route::get('chapters/{id}/export/pdf', 'ChapterExportApiController@exportPdf');
|
Route::get('chapters/{id}/export/pdf', [ChapterExportApiController::class, 'exportPdf']);
|
||||||
Route::get('chapters/{id}/export/plaintext', 'ChapterExportApiController@exportPlainText');
|
Route::get('chapters/{id}/export/plaintext', [ChapterExportApiController::class, 'exportPlainText']);
|
||||||
Route::get('chapters/{id}/export/markdown', 'ChapterExportApiController@exportMarkdown');
|
Route::get('chapters/{id}/export/markdown', [ChapterExportApiController::class, 'exportMarkdown']);
|
||||||
|
|
||||||
Route::get('pages', 'PageApiController@list');
|
Route::get('pages', [PageApiController::class, 'list']);
|
||||||
Route::post('pages', 'PageApiController@create');
|
Route::post('pages', [PageApiController::class, 'create']);
|
||||||
Route::get('pages/{id}', 'PageApiController@read');
|
Route::get('pages/{id}', [PageApiController::class, 'read']);
|
||||||
Route::put('pages/{id}', 'PageApiController@update');
|
Route::put('pages/{id}', [PageApiController::class, 'update']);
|
||||||
Route::delete('pages/{id}', 'PageApiController@delete');
|
Route::delete('pages/{id}', [PageApiController::class, 'delete']);
|
||||||
|
|
||||||
Route::get('pages/{id}/export/html', 'PageExportApiController@exportHtml');
|
Route::get('pages/{id}/export/html', [PageExportApiController::class, 'exportHtml']);
|
||||||
Route::get('pages/{id}/export/pdf', 'PageExportApiController@exportPdf');
|
Route::get('pages/{id}/export/pdf', [PageExportApiController::class, 'exportPdf']);
|
||||||
Route::get('pages/{id}/export/plaintext', 'PageExportApiController@exportPlainText');
|
Route::get('pages/{id}/export/plaintext', [PageExportApiController::class, 'exportPlainText']);
|
||||||
Route::get('pages/{id}/export/markdown', 'PageExportApiController@exportMarkDown');
|
Route::get('pages/{id}/export/markdown', [PageExportApiController::class, 'exportMarkDown']);
|
||||||
|
|
||||||
Route::get('shelves', 'BookshelfApiController@list');
|
Route::get('shelves', [BookshelfApiController::class, 'list']);
|
||||||
Route::post('shelves', 'BookshelfApiController@create');
|
Route::post('shelves', [BookshelfApiController::class, 'create']);
|
||||||
Route::get('shelves/{id}', 'BookshelfApiController@read');
|
Route::get('shelves/{id}', [BookshelfApiController::class, 'read']);
|
||||||
Route::put('shelves/{id}', 'BookshelfApiController@update');
|
Route::put('shelves/{id}', [BookshelfApiController::class, 'update']);
|
||||||
Route::delete('shelves/{id}', 'BookshelfApiController@delete');
|
Route::delete('shelves/{id}', [BookshelfApiController::class, 'delete']);
|
||||||
|
19
routes/console.php
Normal file
19
routes/console.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Inspiring;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Console Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This file is where you may define all of your Closure based console
|
||||||
|
| commands. Each Closure is bound to a command instance allowing a
|
||||||
|
| simple approach to interacting with each command's IO methods.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Artisan::command('inspire', function () {
|
||||||
|
$this->comment(Inspiring::quote());
|
||||||
|
})->purpose('Display an inspiring quote');
|
435
routes/web.php
435
routes/web.php
@ -1,287 +1,318 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
Route::get('/status', 'StatusController@show');
|
use BookStack\Http\Controllers\Api;
|
||||||
Route::get('/robots.txt', 'HomeController@robots');
|
use BookStack\Http\Controllers\AttachmentController;
|
||||||
|
use BookStack\Http\Controllers\AuditLogController;
|
||||||
|
use BookStack\Http\Controllers\Auth;
|
||||||
|
use BookStack\Http\Controllers\BookController;
|
||||||
|
use BookStack\Http\Controllers\BookExportController;
|
||||||
|
use BookStack\Http\Controllers\BookshelfController;
|
||||||
|
use BookStack\Http\Controllers\BookSortController;
|
||||||
|
use BookStack\Http\Controllers\ChapterController;
|
||||||
|
use BookStack\Http\Controllers\ChapterExportController;
|
||||||
|
use BookStack\Http\Controllers\CommentController;
|
||||||
|
use BookStack\Http\Controllers\FavouriteController;
|
||||||
|
use BookStack\Http\Controllers\HomeController;
|
||||||
|
use BookStack\Http\Controllers\Images;
|
||||||
|
use BookStack\Http\Controllers\MaintenanceController;
|
||||||
|
use BookStack\Http\Controllers\PageController;
|
||||||
|
use BookStack\Http\Controllers\PageExportController;
|
||||||
|
use BookStack\Http\Controllers\PageRevisionController;
|
||||||
|
use BookStack\Http\Controllers\PageTemplateController;
|
||||||
|
use BookStack\Http\Controllers\RecycleBinController;
|
||||||
|
use BookStack\Http\Controllers\RoleController;
|
||||||
|
use BookStack\Http\Controllers\SearchController;
|
||||||
|
use BookStack\Http\Controllers\SettingController;
|
||||||
|
use BookStack\Http\Controllers\StatusController;
|
||||||
|
use BookStack\Http\Controllers\TagController;
|
||||||
|
use BookStack\Http\Controllers\UserApiTokenController;
|
||||||
|
use BookStack\Http\Controllers\UserController;
|
||||||
|
use BookStack\Http\Controllers\UserProfileController;
|
||||||
|
use BookStack\Http\Controllers\UserSearchController;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
Route::get('/status', [StatusController::class, 'show']);
|
||||||
|
Route::get('/robots.txt', [HomeController::class, 'robots']);
|
||||||
|
|
||||||
// Authenticated routes...
|
// Authenticated routes...
|
||||||
Route::group(['middleware' => 'auth'], function () {
|
Route::middleware('auth')->group(function () {
|
||||||
|
|
||||||
// Secure images routing
|
// Secure images routing
|
||||||
Route::get('/uploads/images/{path}', 'Images\ImageController@showImage')
|
Route::get('/uploads/images/{path}', [Images\ImageController::class, 'showImage'])
|
||||||
->where('path', '.*$');
|
->where('path', '.*$');
|
||||||
|
|
||||||
// API docs routes
|
// API docs routes
|
||||||
Route::get('/api/docs', 'Api\ApiDocsController@display');
|
Route::get('/api/docs', [Api\ApiDocsController::class, 'display']);
|
||||||
|
|
||||||
Route::get('/pages/recently-updated', 'PageController@showRecentlyUpdated');
|
Route::get('/pages/recently-updated', [PageController::class, 'showRecentlyUpdated']);
|
||||||
|
|
||||||
// Shelves
|
// Shelves
|
||||||
Route::get('/create-shelf', 'BookshelfController@create');
|
Route::get('/create-shelf', [BookshelfController::class, 'create']);
|
||||||
Route::group(['prefix' => 'shelves'], function () {
|
Route::prefix('shelves')->group(function () {
|
||||||
Route::get('/', 'BookshelfController@index');
|
Route::get('/', [BookshelfController::class, 'index']);
|
||||||
Route::post('/', 'BookshelfController@store');
|
Route::post('/', [BookshelfController::class, 'store']);
|
||||||
Route::get('/{slug}/edit', 'BookshelfController@edit');
|
Route::get('/{slug}/edit', [BookshelfController::class, 'edit']);
|
||||||
Route::get('/{slug}/delete', 'BookshelfController@showDelete');
|
Route::get('/{slug}/delete', [BookshelfController::class, 'showDelete']);
|
||||||
Route::get('/{slug}', 'BookshelfController@show');
|
Route::get('/{slug}', [BookshelfController::class, 'show']);
|
||||||
Route::put('/{slug}', 'BookshelfController@update');
|
Route::put('/{slug}', [BookshelfController::class, 'update']);
|
||||||
Route::delete('/{slug}', 'BookshelfController@destroy');
|
Route::delete('/{slug}', [BookshelfController::class, 'destroy']);
|
||||||
Route::get('/{slug}/permissions', 'BookshelfController@showPermissions');
|
Route::get('/{slug}/permissions', [BookshelfController::class, 'showPermissions']);
|
||||||
Route::put('/{slug}/permissions', 'BookshelfController@permissions');
|
Route::put('/{slug}/permissions', [BookshelfController::class, 'permissions']);
|
||||||
Route::post('/{slug}/copy-permissions', 'BookshelfController@copyPermissions');
|
Route::post('/{slug}/copy-permissions', [BookshelfController::class, 'copyPermissions']);
|
||||||
|
|
||||||
Route::get('/{shelfSlug}/create-book', 'BookController@create');
|
Route::get('/{shelfSlug}/create-book', [BookController::class, 'create']);
|
||||||
Route::post('/{shelfSlug}/create-book', 'BookController@store');
|
Route::post('/{shelfSlug}/create-book', [BookController::class, 'store']);
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/create-book', 'BookController@create');
|
Route::get('/create-book', [BookController::class, 'create']);
|
||||||
Route::group(['prefix' => 'books'], function () {
|
Route::prefix('books')->group(function () {
|
||||||
|
|
||||||
// Books
|
// Books
|
||||||
Route::get('/', 'BookController@index');
|
Route::get('/', [BookController::class, 'index']);
|
||||||
Route::post('/', 'BookController@store');
|
Route::post('/', [BookController::class, 'store']);
|
||||||
Route::get('/{slug}/edit', 'BookController@edit');
|
Route::get('/{slug}/edit', [BookController::class, 'edit']);
|
||||||
Route::put('/{slug}', 'BookController@update');
|
Route::put('/{slug}', [BookController::class, 'update']);
|
||||||
Route::delete('/{id}', 'BookController@destroy');
|
Route::delete('/{id}', [BookController::class, 'destroy']);
|
||||||
Route::get('/{slug}/sort-item', 'BookSortController@showItem');
|
Route::get('/{slug}/sort-item', [BookSortController::class, 'showItem']);
|
||||||
Route::get('/{slug}', 'BookController@show');
|
Route::get('/{slug}', [BookController::class, 'show']);
|
||||||
Route::get('/{bookSlug}/permissions', 'BookController@showPermissions');
|
Route::get('/{bookSlug}/permissions', [BookController::class, 'showPermissions']);
|
||||||
Route::put('/{bookSlug}/permissions', 'BookController@permissions');
|
Route::put('/{bookSlug}/permissions', [BookController::class, 'permissions']);
|
||||||
Route::get('/{slug}/delete', 'BookController@showDelete');
|
Route::get('/{slug}/delete', [BookController::class, 'showDelete']);
|
||||||
Route::get('/{bookSlug}/sort', 'BookSortController@show');
|
Route::get('/{bookSlug}/sort', [BookSortController::class, 'show']);
|
||||||
Route::put('/{bookSlug}/sort', 'BookSortController@update');
|
Route::put('/{bookSlug}/sort', [BookSortController::class, 'update']);
|
||||||
Route::get('/{bookSlug}/export/html', 'BookExportController@html');
|
Route::get('/{bookSlug}/export/html', [BookExportController::class, 'html']);
|
||||||
Route::get('/{bookSlug}/export/pdf', 'BookExportController@pdf');
|
Route::get('/{bookSlug}/export/pdf', [BookExportController::class, 'pdf']);
|
||||||
Route::get('/{bookSlug}/export/markdown', 'BookExportController@markdown');
|
Route::get('/{bookSlug}/export/markdown', [BookExportController::class, 'markdown']);
|
||||||
Route::get('/{bookSlug}/export/zip', 'BookExportController@zip');
|
Route::get('/{bookSlug}/export/zip', [BookExportController::class, 'zip']);
|
||||||
Route::get('/{bookSlug}/export/plaintext', 'BookExportController@plainText');
|
Route::get('/{bookSlug}/export/plaintext', [BookExportController::class, 'plainText']);
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
Route::get('/{bookSlug}/create-page', 'PageController@create');
|
Route::get('/{bookSlug}/create-page', [PageController::class, 'create']);
|
||||||
Route::post('/{bookSlug}/create-guest-page', 'PageController@createAsGuest');
|
Route::post('/{bookSlug}/create-guest-page', [PageController::class, 'createAsGuest']);
|
||||||
Route::get('/{bookSlug}/draft/{pageId}', 'PageController@editDraft');
|
Route::get('/{bookSlug}/draft/{pageId}', [PageController::class, 'editDraft']);
|
||||||
Route::post('/{bookSlug}/draft/{pageId}', 'PageController@store');
|
Route::post('/{bookSlug}/draft/{pageId}', [PageController::class, 'store']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}', 'PageController@show');
|
Route::get('/{bookSlug}/page/{pageSlug}', [PageController::class, 'show']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/export/pdf', 'PageExportController@pdf');
|
Route::get('/{bookSlug}/page/{pageSlug}/export/pdf', [PageExportController::class, 'pdf']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/export/html', 'PageExportController@html');
|
Route::get('/{bookSlug}/page/{pageSlug}/export/html', [PageExportController::class, 'html']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/export/markdown', 'PageExportController@markdown');
|
Route::get('/{bookSlug}/page/{pageSlug}/export/markdown', [PageExportController::class, 'markdown']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/export/plaintext', 'PageExportController@plainText');
|
Route::get('/{bookSlug}/page/{pageSlug}/export/plaintext', [PageExportController::class, 'plainText']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/edit', 'PageController@edit');
|
Route::get('/{bookSlug}/page/{pageSlug}/edit', [PageController::class, 'edit']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/move', 'PageController@showMove');
|
Route::get('/{bookSlug}/page/{pageSlug}/move', [PageController::class, 'showMove']);
|
||||||
Route::put('/{bookSlug}/page/{pageSlug}/move', 'PageController@move');
|
Route::put('/{bookSlug}/page/{pageSlug}/move', [PageController::class, 'move']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/copy', 'PageController@showCopy');
|
Route::get('/{bookSlug}/page/{pageSlug}/copy', [PageController::class, 'showCopy']);
|
||||||
Route::post('/{bookSlug}/page/{pageSlug}/copy', 'PageController@copy');
|
Route::post('/{bookSlug}/page/{pageSlug}/copy', [PageController::class, 'copy']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/delete', 'PageController@showDelete');
|
Route::get('/{bookSlug}/page/{pageSlug}/delete', [PageController::class, 'showDelete']);
|
||||||
Route::get('/{bookSlug}/draft/{pageId}/delete', 'PageController@showDeleteDraft');
|
Route::get('/{bookSlug}/draft/{pageId}/delete', [PageController::class, 'showDeleteDraft']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@showPermissions');
|
Route::get('/{bookSlug}/page/{pageSlug}/permissions', [PageController::class, 'showPermissions']);
|
||||||
Route::put('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@permissions');
|
Route::put('/{bookSlug}/page/{pageSlug}/permissions', [PageController::class, 'permissions']);
|
||||||
Route::put('/{bookSlug}/page/{pageSlug}', 'PageController@update');
|
Route::put('/{bookSlug}/page/{pageSlug}', [PageController::class, 'update']);
|
||||||
Route::delete('/{bookSlug}/page/{pageSlug}', 'PageController@destroy');
|
Route::delete('/{bookSlug}/page/{pageSlug}', [PageController::class, 'destroy']);
|
||||||
Route::delete('/{bookSlug}/draft/{pageId}', 'PageController@destroyDraft');
|
Route::delete('/{bookSlug}/draft/{pageId}', [PageController::class, 'destroyDraft']);
|
||||||
|
|
||||||
// Revisions
|
// Revisions
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/revisions', 'PageRevisionController@index');
|
Route::get('/{bookSlug}/page/{pageSlug}/revisions', [PageRevisionController::class, 'index']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}', 'PageRevisionController@show');
|
Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}', [PageRevisionController::class, 'show']);
|
||||||
Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}/changes', 'PageRevisionController@changes');
|
Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}/changes', [PageRevisionController::class, 'changes']);
|
||||||
Route::put('/{bookSlug}/page/{pageSlug}/revisions/{revId}/restore', 'PageRevisionController@restore');
|
Route::put('/{bookSlug}/page/{pageSlug}/revisions/{revId}/restore', [PageRevisionController::class, 'restore']);
|
||||||
Route::delete('/{bookSlug}/page/{pageSlug}/revisions/{revId}/delete', 'PageRevisionController@destroy');
|
Route::delete('/{bookSlug}/page/{pageSlug}/revisions/{revId}/delete', [PageRevisionController::class, 'destroy']);
|
||||||
|
|
||||||
// Chapters
|
// Chapters
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/create-page', 'PageController@create');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}/create-page', [PageController::class, 'create']);
|
||||||
Route::post('/{bookSlug}/chapter/{chapterSlug}/create-guest-page', 'PageController@createAsGuest');
|
Route::post('/{bookSlug}/chapter/{chapterSlug}/create-guest-page', [PageController::class, 'createAsGuest']);
|
||||||
Route::get('/{bookSlug}/create-chapter', 'ChapterController@create');
|
Route::get('/{bookSlug}/create-chapter', [ChapterController::class, 'create']);
|
||||||
Route::post('/{bookSlug}/create-chapter', 'ChapterController@store');
|
Route::post('/{bookSlug}/create-chapter', [ChapterController::class, 'store']);
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@show');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}', [ChapterController::class, 'show']);
|
||||||
Route::put('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@update');
|
Route::put('/{bookSlug}/chapter/{chapterSlug}', [ChapterController::class, 'update']);
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/move', 'ChapterController@showMove');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}/move', [ChapterController::class, 'showMove']);
|
||||||
Route::put('/{bookSlug}/chapter/{chapterSlug}/move', 'ChapterController@move');
|
Route::put('/{bookSlug}/chapter/{chapterSlug}/move', [ChapterController::class, 'move']);
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/edit', 'ChapterController@edit');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}/edit', [ChapterController::class, 'edit']);
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@showPermissions');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}/permissions', [ChapterController::class, 'showPermissions']);
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/pdf', 'ChapterExportController@pdf');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/pdf', [ChapterExportController::class, 'pdf']);
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/html', 'ChapterExportController@html');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/html', [ChapterExportController::class, 'html']);
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/markdown', 'ChapterExportController@markdown');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/markdown', [ChapterExportController::class, 'markdown']);
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/plaintext', 'ChapterExportController@plainText');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/plaintext', [ChapterExportController::class, 'plainText']);
|
||||||
Route::put('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@permissions');
|
Route::put('/{bookSlug}/chapter/{chapterSlug}/permissions', [ChapterController::class, 'permissions']);
|
||||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', 'ChapterController@showDelete');
|
Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', [ChapterController::class, 'showDelete']);
|
||||||
Route::delete('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@destroy');
|
Route::delete('/{bookSlug}/chapter/{chapterSlug}', [ChapterController::class, 'destroy']);
|
||||||
});
|
});
|
||||||
|
|
||||||
// User Profile routes
|
// User Profile routes
|
||||||
Route::get('/user/{slug}', 'UserProfileController@show');
|
Route::get('/user/{slug}', [UserProfileController::class, 'show']);
|
||||||
|
|
||||||
// Image routes
|
// Image routes
|
||||||
Route::get('/images/gallery', 'Images\GalleryImageController@list');
|
Route::get('/images/gallery', [Images\GalleryImageController::class, 'list']);
|
||||||
Route::post('/images/gallery', 'Images\GalleryImageController@create');
|
Route::post('/images/gallery', [Images\GalleryImageController::class, 'create']);
|
||||||
Route::get('/images/drawio', 'Images\DrawioImageController@list');
|
Route::get('/images/drawio', [Images\DrawioImageController::class, 'list']);
|
||||||
Route::get('/images/drawio/base64/{id}', 'Images\DrawioImageController@getAsBase64');
|
Route::get('/images/drawio/base64/{id}', [Images\DrawioImageController::class, 'getAsBase64']);
|
||||||
Route::post('/images/drawio', 'Images\DrawioImageController@create');
|
Route::post('/images/drawio', [Images\DrawioImageController::class, 'create']);
|
||||||
Route::get('/images/edit/{id}', 'Images\ImageController@edit');
|
Route::get('/images/edit/{id}', [Images\ImageController::class, 'edit']);
|
||||||
Route::put('/images/{id}', 'Images\ImageController@update');
|
Route::put('/images/{id}', [Images\ImageController::class, 'update']);
|
||||||
Route::delete('/images/{id}', 'Images\ImageController@destroy');
|
Route::delete('/images/{id}', [Images\ImageController::class, 'destroy']);
|
||||||
|
|
||||||
// Attachments routes
|
// Attachments routes
|
||||||
Route::get('/attachments/{id}', 'AttachmentController@get');
|
Route::get('/attachments/{id}', [AttachmentController::class, 'get']);
|
||||||
Route::post('/attachments/upload', 'AttachmentController@upload');
|
Route::post('/attachments/upload', [AttachmentController::class, 'upload']);
|
||||||
Route::post('/attachments/upload/{id}', 'AttachmentController@uploadUpdate');
|
Route::post('/attachments/upload/{id}', [AttachmentController::class, 'uploadUpdate']);
|
||||||
Route::post('/attachments/link', 'AttachmentController@attachLink');
|
Route::post('/attachments/link', [AttachmentController::class, 'attachLink']);
|
||||||
Route::put('/attachments/{id}', 'AttachmentController@update');
|
Route::put('/attachments/{id}', [AttachmentController::class, 'update']);
|
||||||
Route::get('/attachments/edit/{id}', 'AttachmentController@getUpdateForm');
|
Route::get('/attachments/edit/{id}', [AttachmentController::class, 'getUpdateForm']);
|
||||||
Route::get('/attachments/get/page/{pageId}', 'AttachmentController@listForPage');
|
Route::get('/attachments/get/page/{pageId}', [AttachmentController::class, 'listForPage']);
|
||||||
Route::put('/attachments/sort/page/{pageId}', 'AttachmentController@sortForPage');
|
Route::put('/attachments/sort/page/{pageId}', [AttachmentController::class, 'sortForPage']);
|
||||||
Route::delete('/attachments/{id}', 'AttachmentController@delete');
|
Route::delete('/attachments/{id}', [AttachmentController::class, 'delete']);
|
||||||
|
|
||||||
// AJAX routes
|
// AJAX routes
|
||||||
Route::put('/ajax/page/{id}/save-draft', 'PageController@saveDraft');
|
Route::put('/ajax/page/{id}/save-draft', [PageController::class, 'saveDraft']);
|
||||||
Route::get('/ajax/page/{id}', 'PageController@getPageAjax');
|
Route::get('/ajax/page/{id}', [PageController::class, 'getPageAjax']);
|
||||||
Route::delete('/ajax/page/{id}', 'PageController@ajaxDestroy');
|
Route::delete('/ajax/page/{id}', [PageController::class, 'ajaxDestroy']);
|
||||||
|
|
||||||
// Tag routes (AJAX)
|
// Tag routes (AJAX)
|
||||||
Route::group(['prefix' => 'ajax/tags'], function () {
|
Route::prefix('ajax/tags')->group(function () {
|
||||||
Route::get('/suggest/names', 'TagController@getNameSuggestions');
|
Route::get('/suggest/names', [TagController::class, 'getNameSuggestions']);
|
||||||
Route::get('/suggest/values', 'TagController@getValueSuggestions');
|
Route::get('/suggest/values', [TagController::class, 'getValueSuggestions']);
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/ajax/search/entities', 'SearchController@searchEntitiesAjax');
|
Route::get('/ajax/search/entities', [SearchController::class, 'searchEntitiesAjax']);
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
Route::post('/comment/{pageId}', 'CommentController@savePageComment');
|
Route::post('/comment/{pageId}', [CommentController::class, 'savePageComment']);
|
||||||
Route::put('/comment/{id}', 'CommentController@update');
|
Route::put('/comment/{id}', [CommentController::class, 'update']);
|
||||||
Route::delete('/comment/{id}', 'CommentController@destroy');
|
Route::delete('/comment/{id}', [CommentController::class, 'destroy']);
|
||||||
|
|
||||||
// Links
|
// Links
|
||||||
Route::get('/link/{id}', 'PageController@redirectFromLink');
|
Route::get('/link/{id}', [PageController::class, 'redirectFromLink']);
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
Route::get('/search', 'SearchController@search');
|
Route::get('/search', [SearchController::class, 'search']);
|
||||||
Route::get('/search/book/{bookId}', 'SearchController@searchBook');
|
Route::get('/search/book/{bookId}', [SearchController::class, 'searchBook']);
|
||||||
Route::get('/search/chapter/{bookId}', 'SearchController@searchChapter');
|
Route::get('/search/chapter/{bookId}', [SearchController::class, 'searchChapter']);
|
||||||
Route::get('/search/entity/siblings', 'SearchController@searchSiblings');
|
Route::get('/search/entity/siblings', [SearchController::class, 'searchSiblings']);
|
||||||
|
|
||||||
// User Search
|
// User Search
|
||||||
Route::get('/search/users/select', 'UserSearchController@forSelect');
|
Route::get('/search/users/select', [UserSearchController::class, 'forSelect']);
|
||||||
|
|
||||||
// Template System
|
// Template System
|
||||||
Route::get('/templates', 'PageTemplateController@list');
|
Route::get('/templates', [PageTemplateController::class, 'list']);
|
||||||
Route::get('/templates/{templateId}', 'PageTemplateController@get');
|
Route::get('/templates/{templateId}', [PageTemplateController::class, 'get']);
|
||||||
|
|
||||||
// Favourites
|
// Favourites
|
||||||
Route::get('/favourites', 'FavouriteController@index');
|
Route::get('/favourites', [FavouriteController::class, 'index']);
|
||||||
Route::post('/favourites/add', 'FavouriteController@add');
|
Route::post('/favourites/add', [FavouriteController::class, 'add']);
|
||||||
Route::post('/favourites/remove', 'FavouriteController@remove');
|
Route::post('/favourites/remove', [FavouriteController::class, 'remove']);
|
||||||
|
|
||||||
// Other Pages
|
// Other Pages
|
||||||
Route::get('/', 'HomeController@index');
|
Route::get('/', [HomeController::class, 'index']);
|
||||||
Route::get('/home', 'HomeController@index');
|
Route::get('/home', [HomeController::class, 'index']);
|
||||||
Route::get('/custom-head-content', 'HomeController@customHeadContent');
|
Route::get('/custom-head-content', [HomeController::class, 'customHeadContent']);
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
Route::group(['prefix' => 'settings'], function () {
|
Route::prefix('settings')->group(function () {
|
||||||
Route::get('/', 'SettingController@index')->name('settings');
|
Route::get('/', [SettingController::class, 'index'])->name('settings');
|
||||||
Route::post('/', 'SettingController@update');
|
Route::post('/', [SettingController::class, 'update']);
|
||||||
|
|
||||||
// Maintenance
|
// Maintenance
|
||||||
Route::get('/maintenance', 'MaintenanceController@index');
|
Route::get('/maintenance', [MaintenanceController::class, 'index']);
|
||||||
Route::delete('/maintenance/cleanup-images', 'MaintenanceController@cleanupImages');
|
Route::delete('/maintenance/cleanup-images', [MaintenanceController::class, 'cleanupImages']);
|
||||||
Route::post('/maintenance/send-test-email', 'MaintenanceController@sendTestEmail');
|
Route::post('/maintenance/send-test-email', [MaintenanceController::class, 'sendTestEmail']);
|
||||||
|
|
||||||
// Recycle Bin
|
// Recycle Bin
|
||||||
Route::get('/recycle-bin', 'RecycleBinController@index');
|
Route::get('/recycle-bin', [RecycleBinController::class, 'index']);
|
||||||
Route::post('/recycle-bin/empty', 'RecycleBinController@empty');
|
Route::post('/recycle-bin/empty', [RecycleBinController::class, 'empty']);
|
||||||
Route::get('/recycle-bin/{id}/destroy', 'RecycleBinController@showDestroy');
|
Route::get('/recycle-bin/{id}/destroy', [RecycleBinController::class, 'showDestroy']);
|
||||||
Route::delete('/recycle-bin/{id}', 'RecycleBinController@destroy');
|
Route::delete('/recycle-bin/{id}', [RecycleBinController::class, 'destroy']);
|
||||||
Route::get('/recycle-bin/{id}/restore', 'RecycleBinController@showRestore');
|
Route::get('/recycle-bin/{id}/restore', [RecycleBinController::class, 'showRestore']);
|
||||||
Route::post('/recycle-bin/{id}/restore', 'RecycleBinController@restore');
|
Route::post('/recycle-bin/{id}/restore', [RecycleBinController::class, 'restore']);
|
||||||
|
|
||||||
// Audit Log
|
// Audit Log
|
||||||
Route::get('/audit', 'AuditLogController@index');
|
Route::get('/audit', [AuditLogController::class, 'index']);
|
||||||
|
|
||||||
// Users
|
// Users
|
||||||
Route::get('/users', 'UserController@index');
|
Route::get('/users', [UserController::class, 'index']);
|
||||||
Route::get('/users/create', 'UserController@create');
|
Route::get('/users/create', [UserController::class, 'create']);
|
||||||
Route::get('/users/{id}/delete', 'UserController@delete');
|
Route::get('/users/{id}/delete', [UserController::class, 'delete']);
|
||||||
Route::patch('/users/{id}/switch-books-view', 'UserController@switchBooksView');
|
Route::patch('/users/{id}/switch-books-view', [UserController::class, 'switchBooksView']);
|
||||||
Route::patch('/users/{id}/switch-shelves-view', 'UserController@switchShelvesView');
|
Route::patch('/users/{id}/switch-shelves-view', [UserController::class, 'switchShelvesView']);
|
||||||
Route::patch('/users/{id}/switch-shelf-view', 'UserController@switchShelfView');
|
Route::patch('/users/{id}/switch-shelf-view', [UserController::class, 'switchShelfView']);
|
||||||
Route::patch('/users/{id}/change-sort/{type}', 'UserController@changeSort');
|
Route::patch('/users/{id}/change-sort/{type}', [UserController::class, 'changeSort']);
|
||||||
Route::patch('/users/{id}/update-expansion-preference/{key}', 'UserController@updateExpansionPreference');
|
Route::patch('/users/{id}/update-expansion-preference/{key}', [UserController::class, 'updateExpansionPreference']);
|
||||||
Route::patch('/users/toggle-dark-mode', 'UserController@toggleDarkMode');
|
Route::patch('/users/toggle-dark-mode', [UserController::class, 'toggleDarkMode']);
|
||||||
Route::post('/users/create', 'UserController@store');
|
Route::post('/users/create', [UserController::class, 'store']);
|
||||||
Route::get('/users/{id}', 'UserController@edit');
|
Route::get('/users/{id}', [UserController::class, 'edit']);
|
||||||
Route::put('/users/{id}', 'UserController@update');
|
Route::put('/users/{id}', [UserController::class, 'update']);
|
||||||
Route::delete('/users/{id}', 'UserController@destroy');
|
Route::delete('/users/{id}', [UserController::class, 'destroy']);
|
||||||
|
|
||||||
// User API Tokens
|
// User API Tokens
|
||||||
Route::get('/users/{userId}/create-api-token', 'UserApiTokenController@create');
|
Route::get('/users/{userId}/create-api-token', [UserApiTokenController::class, 'create']);
|
||||||
Route::post('/users/{userId}/create-api-token', 'UserApiTokenController@store');
|
Route::post('/users/{userId}/create-api-token', [UserApiTokenController::class, 'store']);
|
||||||
Route::get('/users/{userId}/api-tokens/{tokenId}', 'UserApiTokenController@edit');
|
Route::get('/users/{userId}/api-tokens/{tokenId}', [UserApiTokenController::class, 'edit']);
|
||||||
Route::put('/users/{userId}/api-tokens/{tokenId}', 'UserApiTokenController@update');
|
Route::put('/users/{userId}/api-tokens/{tokenId}', [UserApiTokenController::class, 'update']);
|
||||||
Route::get('/users/{userId}/api-tokens/{tokenId}/delete', 'UserApiTokenController@delete');
|
Route::get('/users/{userId}/api-tokens/{tokenId}/delete', [UserApiTokenController::class, 'delete']);
|
||||||
Route::delete('/users/{userId}/api-tokens/{tokenId}', 'UserApiTokenController@destroy');
|
Route::delete('/users/{userId}/api-tokens/{tokenId}', [UserApiTokenController::class, 'destroy']);
|
||||||
|
|
||||||
// Roles
|
// Roles
|
||||||
Route::get('/roles', 'RoleController@list');
|
Route::get('/roles', [RoleController::class, 'list']);
|
||||||
Route::get('/roles/new', 'RoleController@create');
|
Route::get('/roles/new', [RoleController::class, 'create']);
|
||||||
Route::post('/roles/new', 'RoleController@store');
|
Route::post('/roles/new', [RoleController::class, 'store']);
|
||||||
Route::get('/roles/delete/{id}', 'RoleController@showDelete');
|
Route::get('/roles/delete/{id}', [RoleController::class, 'showDelete']);
|
||||||
Route::delete('/roles/delete/{id}', 'RoleController@delete');
|
Route::delete('/roles/delete/{id}', [RoleController::class, 'delete']);
|
||||||
Route::get('/roles/{id}', 'RoleController@edit');
|
Route::get('/roles/{id}', [RoleController::class, 'edit']);
|
||||||
Route::put('/roles/{id}', 'RoleController@update');
|
Route::put('/roles/{id}', [RoleController::class, 'update']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// MFA routes
|
// MFA routes
|
||||||
Route::group(['middleware' => 'mfa-setup'], function () {
|
Route::middleware('mfa-setup')->group(function () {
|
||||||
Route::get('/mfa/setup', 'Auth\MfaController@setup');
|
Route::get('/mfa/setup', [Auth\MfaController::class, 'setup']);
|
||||||
Route::get('/mfa/totp/generate', 'Auth\MfaTotpController@generate');
|
Route::get('/mfa/totp/generate', [Auth\MfaTotpController::class, 'generate']);
|
||||||
Route::post('/mfa/totp/confirm', 'Auth\MfaTotpController@confirm');
|
Route::post('/mfa/totp/confirm', [Auth\MfaTotpController::class, 'confirm']);
|
||||||
Route::get('/mfa/backup_codes/generate', 'Auth\MfaBackupCodesController@generate');
|
Route::get('/mfa/backup_codes/generate', [Auth\MfaBackupCodesController::class, 'generate']);
|
||||||
Route::post('/mfa/backup_codes/confirm', 'Auth\MfaBackupCodesController@confirm');
|
Route::post('/mfa/backup_codes/confirm', [Auth\MfaBackupCodesController::class, 'confirm']);
|
||||||
});
|
});
|
||||||
Route::group(['middleware' => 'guest'], function () {
|
Route::middleware('guest')->group(function () {
|
||||||
Route::get('/mfa/verify', 'Auth\MfaController@verify');
|
Route::get('/mfa/verify', [Auth\MfaController::class, 'verify']);
|
||||||
Route::post('/mfa/totp/verify', 'Auth\MfaTotpController@verify');
|
Route::post('/mfa/totp/verify', [Auth\MfaTotpController::class, 'verify']);
|
||||||
Route::post('/mfa/backup_codes/verify', 'Auth\MfaBackupCodesController@verify');
|
Route::post('/mfa/backup_codes/verify', [Auth\MfaBackupCodesController::class, 'verify']);
|
||||||
});
|
});
|
||||||
Route::delete('/mfa/{method}/remove', 'Auth\MfaController@remove')->middleware('auth');
|
Route::delete('/mfa/{method}/remove', [Auth\MfaController::class, 'remove'])->middleware('auth');
|
||||||
|
|
||||||
// Social auth routes
|
// Social auth routes
|
||||||
Route::get('/login/service/{socialDriver}', 'Auth\SocialController@login');
|
Route::get('/login/service/{socialDriver}', [Auth\SocialController::class, 'login']);
|
||||||
Route::get('/login/service/{socialDriver}/callback', 'Auth\SocialController@callback');
|
Route::get('/login/service/{socialDriver}/callback', [Auth\SocialController::class, 'callback']);
|
||||||
Route::post('/login/service/{socialDriver}/detach', 'Auth\SocialController@detach')->middleware('auth');
|
Route::post('/login/service/{socialDriver}/detach', [Auth\SocialController::class, 'detach'])->middleware('auth');
|
||||||
Route::get('/register/service/{socialDriver}', 'Auth\SocialController@register');
|
Route::get('/register/service/{socialDriver}', [Auth\SocialController::class, 'register']);
|
||||||
|
|
||||||
// Login/Logout routes
|
// Login/Logout routes
|
||||||
Route::get('/login', 'Auth\LoginController@getLogin');
|
Route::get('/login', [Auth\LoginController::class, 'getLogin']);
|
||||||
Route::post('/login', 'Auth\LoginController@login');
|
Route::post('/login', [Auth\LoginController::class, 'login']);
|
||||||
Route::get('/logout', 'Auth\LoginController@logout');
|
Route::get('/logout', [Auth\LoginController::class, 'logout']);
|
||||||
Route::get('/register', 'Auth\RegisterController@getRegister');
|
Route::get('/register', [Auth\RegisterController::class, 'getRegister']);
|
||||||
Route::get('/register/confirm', 'Auth\ConfirmEmailController@show');
|
Route::get('/register/confirm', [Auth\ConfirmEmailController::class, 'show']);
|
||||||
Route::get('/register/confirm/awaiting', 'Auth\ConfirmEmailController@showAwaiting');
|
Route::get('/register/confirm/awaiting', [Auth\ConfirmEmailController::class, 'showAwaiting']);
|
||||||
Route::post('/register/confirm/resend', 'Auth\ConfirmEmailController@resend');
|
Route::post('/register/confirm/resend', [Auth\ConfirmEmailController::class, 'resend']);
|
||||||
Route::get('/register/confirm/{token}', 'Auth\ConfirmEmailController@confirm');
|
Route::get('/register/confirm/{token}', [Auth\ConfirmEmailController::class, 'confirm']);
|
||||||
Route::post('/register', 'Auth\RegisterController@postRegister');
|
Route::post('/register', [Auth\RegisterController::class, 'postRegister']);
|
||||||
|
|
||||||
// SAML routes
|
// SAML routes
|
||||||
Route::post('/saml2/login', 'Auth\Saml2Controller@login');
|
Route::post('/saml2/login', [Auth\Saml2Controller::class, 'login']);
|
||||||
Route::get('/saml2/logout', 'Auth\Saml2Controller@logout');
|
Route::get('/saml2/logout', [Auth\Saml2Controller::class, 'logout']);
|
||||||
Route::get('/saml2/metadata', 'Auth\Saml2Controller@metadata');
|
Route::get('/saml2/metadata', [Auth\Saml2Controller::class, 'metadata']);
|
||||||
Route::get('/saml2/sls', 'Auth\Saml2Controller@sls');
|
Route::get('/saml2/sls', [Auth\Saml2Controller::class, 'sls']);
|
||||||
Route::post('/saml2/acs', 'Auth\Saml2Controller@startAcs');
|
Route::post('/saml2/acs', [Auth\Saml2Controller::class, 'startAcs']);
|
||||||
Route::get('/saml2/acs', 'Auth\Saml2Controller@processAcs');
|
Route::get('/saml2/acs', [Auth\Saml2Controller::class, 'processAcs']);
|
||||||
|
|
||||||
// OIDC routes
|
// OIDC routes
|
||||||
Route::post('/oidc/login', 'Auth\OidcController@login');
|
Route::post('/oidc/login', [Auth\OidcController::class, 'login']);
|
||||||
Route::get('/oidc/callback', 'Auth\OidcController@callback');
|
Route::get('/oidc/callback', [Auth\OidcController::class, 'callback']);
|
||||||
|
|
||||||
// User invitation routes
|
// User invitation routes
|
||||||
Route::get('/register/invite/{token}', 'Auth\UserInviteController@showSetPassword');
|
Route::get('/register/invite/{token}', [Auth\UserInviteController::class, 'showSetPassword']);
|
||||||
Route::post('/register/invite/{token}', 'Auth\UserInviteController@setPassword');
|
Route::post('/register/invite/{token}', [Auth\UserInviteController::class, 'setPassword']);
|
||||||
|
|
||||||
// Password reset link request routes...
|
// Password reset link request routes...
|
||||||
Route::get('/password/email', 'Auth\ForgotPasswordController@showLinkRequestForm');
|
Route::get('/password/email', [Auth\ForgotPasswordController::class, 'showLinkRequestForm']);
|
||||||
Route::post('/password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
|
Route::post('/password/email', [Auth\ForgotPasswordController::class, 'sendResetLinkEmail']);
|
||||||
|
|
||||||
// Password reset routes...
|
// Password reset routes...
|
||||||
Route::get('/password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
|
Route::get('/password/reset/{token}', [Auth\ResetPasswordController::class, 'showResetForm']);
|
||||||
Route::post('/password/reset', 'Auth\ResetPasswordController@reset');
|
Route::post('/password/reset', [Auth\ResetPasswordController::class, 'reset']);
|
||||||
|
|
||||||
Route::fallback('HomeController@notFound')->name('fallback');
|
Route::fallback([HomeController::class, 'notFound'])->name('fallback');
|
||||||
|
12
storage/framework/.gitignore
vendored
12
storage/framework/.gitignore
vendored
@ -1,7 +1,9 @@
|
|||||||
config.php
|
|
||||||
routes.php
|
|
||||||
compiled.php
|
compiled.php
|
||||||
services.json
|
config.php
|
||||||
events.scanned.php
|
|
||||||
routes.scanned.php
|
|
||||||
down
|
down
|
||||||
|
events.scanned.php
|
||||||
|
maintenance.php
|
||||||
|
routes.php
|
||||||
|
routes.scanned.php
|
||||||
|
schedule-*
|
||||||
|
services.json
|
||||||
|
@ -17,7 +17,7 @@ class AuditLogTest extends TestCase
|
|||||||
/** @var ActivityService */
|
/** @var ActivityService */
|
||||||
protected $activityService;
|
protected $activityService;
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->activityService = app(ActivityService::class);
|
$this->activityService = app(ActivityService::class);
|
||||||
|
@ -44,7 +44,7 @@ class AuthTest extends TestCase
|
|||||||
{
|
{
|
||||||
// Set settings and get user instance
|
// Set settings and get user instance
|
||||||
$this->setSettings(['registration-enabled' => 'true']);
|
$this->setSettings(['registration-enabled' => 'true']);
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
|
|
||||||
// Test form and ensure user is created
|
// Test form and ensure user is created
|
||||||
$this->get('/register')
|
$this->get('/register')
|
||||||
@ -102,7 +102,7 @@ class AuthTest extends TestCase
|
|||||||
|
|
||||||
// Set settings and get user instance
|
// Set settings and get user instance
|
||||||
$this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'true']);
|
$this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'true']);
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
|
|
||||||
// Go through registration process
|
// Go through registration process
|
||||||
$resp = $this->post('/register', $user->only('name', 'email', 'password'));
|
$resp = $this->post('/register', $user->only('name', 'email', 'password'));
|
||||||
@ -140,7 +140,7 @@ class AuthTest extends TestCase
|
|||||||
public function test_restricted_registration()
|
public function test_restricted_registration()
|
||||||
{
|
{
|
||||||
$this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'true', 'registration-restrict' => 'example.com']);
|
$this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'true', 'registration-restrict' => 'example.com']);
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
|
|
||||||
// Go through registration process
|
// Go through registration process
|
||||||
$this->post('/register', $user->only('name', 'email', 'password'))
|
$this->post('/register', $user->only('name', 'email', 'password'))
|
||||||
@ -166,7 +166,7 @@ class AuthTest extends TestCase
|
|||||||
public function test_restricted_registration_with_confirmation_disabled()
|
public function test_restricted_registration_with_confirmation_disabled()
|
||||||
{
|
{
|
||||||
$this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'false', 'registration-restrict' => 'example.com']);
|
$this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'false', 'registration-restrict' => 'example.com']);
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
|
|
||||||
// Go through registration process
|
// Go through registration process
|
||||||
$this->post('/register', $user->only('name', 'email', 'password'))
|
$this->post('/register', $user->only('name', 'email', 'password'))
|
||||||
|
@ -20,7 +20,7 @@ class LdapTest extends TestCase
|
|||||||
protected $mockUser;
|
protected $mockUser;
|
||||||
protected $resourceId = 'resource-test';
|
protected $resourceId = 'resource-test';
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
if (!defined('LDAP_OPT_REFERRALS')) {
|
if (!defined('LDAP_OPT_REFERRALS')) {
|
||||||
@ -42,7 +42,7 @@ class LdapTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
$this->mockLdap = \Mockery::mock(Ldap::class);
|
$this->mockLdap = \Mockery::mock(Ldap::class);
|
||||||
$this->app[Ldap::class] = $this->mockLdap;
|
$this->app[Ldap::class] = $this->mockLdap;
|
||||||
$this->mockUser = factory(User::class)->make();
|
$this->mockUser = User::factory()->make();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function runFailedAuthLogin()
|
protected function runFailedAuthLogin()
|
||||||
@ -264,9 +264,9 @@ class LdapTest extends TestCase
|
|||||||
|
|
||||||
public function test_login_maps_roles_and_retains_existing_roles()
|
public function test_login_maps_roles_and_retains_existing_roles()
|
||||||
{
|
{
|
||||||
$roleToReceive = factory(Role::class)->create(['display_name' => 'LdapTester']);
|
$roleToReceive = Role::factory()->create(['display_name' => 'LdapTester']);
|
||||||
$roleToReceive2 = factory(Role::class)->create(['display_name' => 'LdapTester Second']);
|
$roleToReceive2 = Role::factory()->create(['display_name' => 'LdapTester Second']);
|
||||||
$existingRole = factory(Role::class)->create(['display_name' => 'ldaptester-existing']);
|
$existingRole = Role::factory()->create(['display_name' => 'ldaptester-existing']);
|
||||||
$this->mockUser->forceFill(['external_auth_id' => $this->mockUser->name])->save();
|
$this->mockUser->forceFill(['external_auth_id' => $this->mockUser->name])->save();
|
||||||
$this->mockUser->attachRole($existingRole);
|
$this->mockUser->attachRole($existingRole);
|
||||||
|
|
||||||
@ -310,8 +310,8 @@ class LdapTest extends TestCase
|
|||||||
|
|
||||||
public function test_login_maps_roles_and_removes_old_roles_if_set()
|
public function test_login_maps_roles_and_removes_old_roles_if_set()
|
||||||
{
|
{
|
||||||
$roleToReceive = factory(Role::class)->create(['display_name' => 'LdapTester']);
|
$roleToReceive = Role::factory()->create(['display_name' => 'LdapTester']);
|
||||||
$existingRole = factory(Role::class)->create(['display_name' => 'ldaptester-existing']);
|
$existingRole = Role::factory()->create(['display_name' => 'ldaptester-existing']);
|
||||||
$this->mockUser->forceFill(['external_auth_id' => $this->mockUser->name])->save();
|
$this->mockUser->forceFill(['external_auth_id' => $this->mockUser->name])->save();
|
||||||
$this->mockUser->attachRole($existingRole);
|
$this->mockUser->attachRole($existingRole);
|
||||||
|
|
||||||
@ -350,15 +350,15 @@ class LdapTest extends TestCase
|
|||||||
|
|
||||||
public function test_external_auth_id_visible_in_roles_page_when_ldap_active()
|
public function test_external_auth_id_visible_in_roles_page_when_ldap_active()
|
||||||
{
|
{
|
||||||
$role = factory(Role::class)->create(['display_name' => 'ldaptester', 'external_auth_id' => 'ex-auth-a, test-second-param']);
|
$role = Role::factory()->create(['display_name' => 'ldaptester', 'external_auth_id' => 'ex-auth-a, test-second-param']);
|
||||||
$this->asAdmin()->get('/settings/roles/' . $role->id)
|
$this->asAdmin()->get('/settings/roles/' . $role->id)
|
||||||
->assertSee('ex-auth-a');
|
->assertSee('ex-auth-a');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_login_maps_roles_using_external_auth_ids_if_set()
|
public function test_login_maps_roles_using_external_auth_ids_if_set()
|
||||||
{
|
{
|
||||||
$roleToReceive = factory(Role::class)->create(['display_name' => 'ldaptester', 'external_auth_id' => 'test-second-param, ex-auth-a']);
|
$roleToReceive = Role::factory()->create(['display_name' => 'ldaptester', 'external_auth_id' => 'test-second-param, ex-auth-a']);
|
||||||
$roleToNotReceive = factory(Role::class)->create(['display_name' => 'ex-auth-a', 'external_auth_id' => 'test-second-param']);
|
$roleToNotReceive = Role::factory()->create(['display_name' => 'ex-auth-a', 'external_auth_id' => 'test-second-param']);
|
||||||
|
|
||||||
app('config')->set([
|
app('config')->set([
|
||||||
'services.ldap.user_to_groups' => true,
|
'services.ldap.user_to_groups' => true,
|
||||||
@ -395,8 +395,8 @@ class LdapTest extends TestCase
|
|||||||
|
|
||||||
public function test_login_group_mapping_does_not_conflict_with_default_role()
|
public function test_login_group_mapping_does_not_conflict_with_default_role()
|
||||||
{
|
{
|
||||||
$roleToReceive = factory(Role::class)->create(['display_name' => 'LdapTester']);
|
$roleToReceive = Role::factory()->create(['display_name' => 'LdapTester']);
|
||||||
$roleToReceive2 = factory(Role::class)->create(['display_name' => 'LdapTester Second']);
|
$roleToReceive2 = Role::factory()->create(['display_name' => 'LdapTester Second']);
|
||||||
$this->mockUser->forceFill(['external_auth_id' => $this->mockUser->name])->save();
|
$this->mockUser->forceFill(['external_auth_id' => $this->mockUser->name])->save();
|
||||||
|
|
||||||
setting()->put('registration-role', $roleToReceive->id);
|
setting()->put('registration-role', $roleToReceive->id);
|
||||||
@ -641,8 +641,8 @@ class LdapTest extends TestCase
|
|||||||
|
|
||||||
public function test_login_with_email_confirmation_required_maps_groups_but_shows_confirmation_screen()
|
public function test_login_with_email_confirmation_required_maps_groups_but_shows_confirmation_screen()
|
||||||
{
|
{
|
||||||
$roleToReceive = factory(Role::class)->create(['display_name' => 'LdapTester']);
|
$roleToReceive = Role::factory()->create(['display_name' => 'LdapTester']);
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
setting()->put('registration-confirmation', 'true');
|
setting()->put('registration-confirmation', 'true');
|
||||||
|
|
||||||
app('config')->set([
|
app('config')->set([
|
||||||
|
@ -16,7 +16,7 @@ class OidcTest extends TestCase
|
|||||||
protected $keyFilePath;
|
protected $keyFilePath;
|
||||||
protected $keyFile;
|
protected $keyFile;
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
// Set default config for OpenID Connect
|
// Set default config for OpenID Connect
|
||||||
@ -41,7 +41,7 @@ class OidcTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown(): void
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
if (file_exists($this->keyFilePath)) {
|
if (file_exists($this->keyFilePath)) {
|
||||||
|
@ -8,7 +8,7 @@ use Tests\TestCase;
|
|||||||
|
|
||||||
class Saml2Test extends TestCase
|
class Saml2Test extends TestCase
|
||||||
{
|
{
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
// Set default config for SAML2
|
// Set default config for SAML2
|
||||||
@ -119,7 +119,7 @@ class Saml2Test extends TestCase
|
|||||||
'saml2.remove_from_groups' => false,
|
'saml2.remove_from_groups' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$memberRole = factory(Role::class)->create(['external_auth_id' => 'member']);
|
$memberRole = Role::factory()->create(['external_auth_id' => 'member']);
|
||||||
$adminRole = Role::getSystemRole('admin');
|
$adminRole = Role::getSystemRole('admin');
|
||||||
|
|
||||||
$this->followingRedirects()->post('/saml2/acs', ['SAMLResponse' => $this->acsPostData]);
|
$this->followingRedirects()->post('/saml2/acs', ['SAMLResponse' => $this->acsPostData]);
|
||||||
@ -141,7 +141,7 @@ class Saml2Test extends TestCase
|
|||||||
$acsPost = $this->followingRedirects()->post('/saml2/acs', ['SAMLResponse' => $this->acsPostData]);
|
$acsPost = $this->followingRedirects()->post('/saml2/acs', ['SAMLResponse' => $this->acsPostData]);
|
||||||
$user = User::query()->where('external_auth_id', '=', 'user')->first();
|
$user = User::query()->where('external_auth_id', '=', 'user')->first();
|
||||||
|
|
||||||
$randomRole = factory(Role::class)->create(['external_auth_id' => 'random']);
|
$randomRole = Role::factory()->create(['external_auth_id' => 'random']);
|
||||||
$user->attachRole($randomRole);
|
$user->attachRole($randomRole);
|
||||||
$this->assertContains($randomRole->id, $user->roles()->pluck('id'));
|
$this->assertContains($randomRole->id, $user->roles()->pluck('id'));
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ class Saml2Test extends TestCase
|
|||||||
'saml2.remove_from_groups' => false,
|
'saml2.remove_from_groups' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$memberRole = factory(Role::class)->create(['external_auth_id' => 'member']);
|
$memberRole = Role::factory()->create(['external_auth_id' => 'member']);
|
||||||
$adminRole = Role::getSystemRole('admin');
|
$adminRole = Role::getSystemRole('admin');
|
||||||
|
|
||||||
$acsPost = $this->followingRedirects()->post('/saml2/acs', ['SAMLResponse' => $this->acsPostData]);
|
$acsPost = $this->followingRedirects()->post('/saml2/acs', ['SAMLResponse' => $this->acsPostData]);
|
||||||
|
@ -15,7 +15,7 @@ class SocialAuthTest extends TestCase
|
|||||||
{
|
{
|
||||||
public function test_social_registration()
|
public function test_social_registration()
|
||||||
{
|
{
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
|
|
||||||
$this->setSettings(['registration-enabled' => 'true']);
|
$this->setSettings(['registration-enabled' => 'true']);
|
||||||
config(['GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
|
config(['GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
|
||||||
@ -118,7 +118,7 @@ class SocialAuthTest extends TestCase
|
|||||||
'APP_URL' => 'http://localhost',
|
'APP_URL' => 'http://localhost',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
$mockSocialite = $this->mock(Factory::class);
|
$mockSocialite = $this->mock(Factory::class);
|
||||||
$mockSocialDriver = Mockery::mock(Provider::class);
|
$mockSocialDriver = Mockery::mock(Provider::class);
|
||||||
$mockSocialUser = Mockery::mock(\Laravel\Socialite\Contracts\User::class);
|
$mockSocialUser = Mockery::mock(\Laravel\Socialite\Contracts\User::class);
|
||||||
@ -156,7 +156,7 @@ class SocialAuthTest extends TestCase
|
|||||||
'APP_URL' => 'http://localhost', 'services.google.auto_register' => true, 'services.google.auto_confirm' => true,
|
'APP_URL' => 'http://localhost', 'services.google.auto_register' => true, 'services.google.auto_confirm' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
$mockSocialite = $this->mock(Factory::class);
|
$mockSocialite = $this->mock(Factory::class);
|
||||||
$mockSocialDriver = Mockery::mock(Provider::class);
|
$mockSocialDriver = Mockery::mock(Provider::class);
|
||||||
$mockSocialUser = Mockery::mock(\Laravel\Socialite\Contracts\User::class);
|
$mockSocialUser = Mockery::mock(\Laravel\Socialite\Contracts\User::class);
|
||||||
@ -188,7 +188,7 @@ class SocialAuthTest extends TestCase
|
|||||||
|
|
||||||
public function test_social_registration_with_no_name_uses_email_as_name()
|
public function test_social_registration_with_no_name_uses_email_as_name()
|
||||||
{
|
{
|
||||||
$user = factory(User::class)->make(['email' => 'nonameuser@example.com']);
|
$user = User::factory()->make(['email' => 'nonameuser@example.com']);
|
||||||
|
|
||||||
$this->setSettings(['registration-enabled' => 'true']);
|
$this->setSettings(['registration-enabled' => 'true']);
|
||||||
config(['GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
|
config(['GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
|
||||||
|
@ -37,7 +37,7 @@ class BookShelfTest extends TestCase
|
|||||||
|
|
||||||
public function test_shelves_shows_in_header_if_have_any_shelve_view_permission()
|
public function test_shelves_shows_in_header_if_have_any_shelve_view_permission()
|
||||||
{
|
{
|
||||||
$user = factory(User::class)->create();
|
$user = User::factory()->create();
|
||||||
$this->giveUserPermissions($user, ['image-create-all']);
|
$this->giveUserPermissions($user, ['image-create-all']);
|
||||||
$shelf = Bookshelf::first();
|
$shelf = Bookshelf::first();
|
||||||
$userRole = $user->roles()->first();
|
$userRole = $user->roles()->first();
|
||||||
|
@ -9,7 +9,7 @@ class BookTest extends TestCase
|
|||||||
{
|
{
|
||||||
public function test_create()
|
public function test_create()
|
||||||
{
|
{
|
||||||
$book = factory(Book::class)->make([
|
$book = Book::factory()->make([
|
||||||
'name' => 'My First Book',
|
'name' => 'My First Book',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ class BookTest extends TestCase
|
|||||||
|
|
||||||
public function test_create_uses_different_slugs_when_name_reused()
|
public function test_create_uses_different_slugs_when_name_reused()
|
||||||
{
|
{
|
||||||
$book = factory(Book::class)->make([
|
$book = Book::factory()->make([
|
||||||
'name' => 'My First Book',
|
'name' => 'My First Book',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ class ChapterTest extends TestCase
|
|||||||
/** @var Book $book */
|
/** @var Book $book */
|
||||||
$book = Book::query()->first();
|
$book = Book::query()->first();
|
||||||
|
|
||||||
$chapter = factory(Chapter::class)->make([
|
$chapter = Chapter::factory()->make([
|
||||||
'name' => 'My First Chapter',
|
'name' => 'My First Chapter',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class CommentSettingTest extends TestCase
|
|||||||
{
|
{
|
||||||
protected $page;
|
protected $page;
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->page = Page::query()->first();
|
$this->page = Page::query()->first();
|
||||||
|
@ -13,7 +13,7 @@ class CommentTest extends TestCase
|
|||||||
$this->asAdmin();
|
$this->asAdmin();
|
||||||
$page = Page::first();
|
$page = Page::first();
|
||||||
|
|
||||||
$comment = factory(Comment::class)->make(['parent_id' => 2]);
|
$comment = Comment::factory()->make(['parent_id' => 2]);
|
||||||
$resp = $this->postJson("/comment/$page->id", $comment->getAttributes());
|
$resp = $this->postJson("/comment/$page->id", $comment->getAttributes());
|
||||||
|
|
||||||
$resp->assertStatus(200);
|
$resp->assertStatus(200);
|
||||||
@ -36,7 +36,7 @@ class CommentTest extends TestCase
|
|||||||
$this->asAdmin();
|
$this->asAdmin();
|
||||||
$page = Page::first();
|
$page = Page::first();
|
||||||
|
|
||||||
$comment = factory(Comment::class)->make();
|
$comment = Comment::factory()->make();
|
||||||
$this->postJson("/comment/$page->id", $comment->getAttributes());
|
$this->postJson("/comment/$page->id", $comment->getAttributes());
|
||||||
|
|
||||||
$comment = $page->comments()->first();
|
$comment = $page->comments()->first();
|
||||||
@ -60,7 +60,7 @@ class CommentTest extends TestCase
|
|||||||
$this->asAdmin();
|
$this->asAdmin();
|
||||||
$page = Page::first();
|
$page = Page::first();
|
||||||
|
|
||||||
$comment = factory(Comment::class)->make();
|
$comment = Comment::factory()->make();
|
||||||
$this->postJson("/comment/$page->id", $comment->getAttributes());
|
$this->postJson("/comment/$page->id", $comment->getAttributes());
|
||||||
|
|
||||||
$comment = $page->comments()->first();
|
$comment = $page->comments()->first();
|
||||||
|
@ -20,7 +20,7 @@ class PageDraftTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
protected $pageRepo;
|
protected $pageRepo;
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->page = Page::query()->first();
|
$this->page = Page::query()->first();
|
||||||
|
@ -11,7 +11,7 @@ class PageEditorTest extends TestCase
|
|||||||
/** @var Page */
|
/** @var Page */
|
||||||
protected $page;
|
protected $page;
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->page = Page::query()->first();
|
$this->page = Page::query()->first();
|
||||||
|
@ -14,7 +14,7 @@ class PageTest extends TestCase
|
|||||||
{
|
{
|
||||||
/** @var Chapter $chapter */
|
/** @var Chapter $chapter */
|
||||||
$chapter = Chapter::query()->first();
|
$chapter = Chapter::query()->first();
|
||||||
$page = factory(Page::class)->make([
|
$page = Page::factory()->make([
|
||||||
'name' => 'My First Page',
|
'name' => 'My First Page',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class SortTest extends TestCase
|
|||||||
{
|
{
|
||||||
protected $book;
|
protected $book;
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->book = Book::first();
|
$this->book = Book::first();
|
||||||
|
@ -19,7 +19,7 @@ class TagTest extends TestCase
|
|||||||
$entity = $class::first();
|
$entity = $class::first();
|
||||||
|
|
||||||
if (is_null($tags)) {
|
if (is_null($tags)) {
|
||||||
$tags = factory(Tag::class, $this->defaultTagCount)->make();
|
$tags = Tag::factory()->count($this->defaultTagCount)->make();
|
||||||
}
|
}
|
||||||
|
|
||||||
$entity->tags()->saveMany($tags);
|
$entity->tags()->saveMany($tags);
|
||||||
@ -31,63 +31,63 @@ class TagTest extends TestCase
|
|||||||
{
|
{
|
||||||
// Create some tags with similar names to test with
|
// Create some tags with similar names to test with
|
||||||
$attrs = collect();
|
$attrs = collect();
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'country']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'color']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'color']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'city']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'city']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'county']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'county']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'planet']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'planet']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'plans']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'plans']));
|
||||||
$page = $this->getEntityWithTags(Page::class, $attrs->all());
|
$page = $this->getEntityWithTags(Page::class, $attrs->all());
|
||||||
|
|
||||||
$this->asAdmin()->get('/ajax/tags/suggest/names?search=dog')->assertExactJson([]);
|
$this->asAdmin()->get('/ajax/tags/suggest/names?search=dog')->assertSimilarJson([]);
|
||||||
$this->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country', 'county']);
|
$this->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson(['color', 'country', 'county']);
|
||||||
$this->get('/ajax/tags/suggest/names?search=cou')->assertExactJson(['country', 'county']);
|
$this->get('/ajax/tags/suggest/names?search=cou')->assertSimilarJson(['country', 'county']);
|
||||||
$this->get('/ajax/tags/suggest/names?search=pla')->assertExactJson(['planet', 'plans']);
|
$this->get('/ajax/tags/suggest/names?search=pla')->assertSimilarJson(['planet', 'plans']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_tag_value_suggestions()
|
public function test_tag_value_suggestions()
|
||||||
{
|
{
|
||||||
// Create some tags with similar values to test with
|
// Create some tags with similar values to test with
|
||||||
$attrs = collect();
|
$attrs = collect();
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country', 'value' => 'cats']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'country', 'value' => 'cats']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'color', 'value' => 'cattery']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'color', 'value' => 'cattery']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'city', 'value' => 'castle']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'city', 'value' => 'castle']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'county', 'value' => 'dog']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'county', 'value' => 'dog']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'planet', 'value' => 'catapult']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'planet', 'value' => 'catapult']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'plans', 'value' => 'dodgy']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'plans', 'value' => 'dodgy']));
|
||||||
$page = $this->getEntityWithTags(Page::class, $attrs->all());
|
$page = $this->getEntityWithTags(Page::class, $attrs->all());
|
||||||
|
|
||||||
$this->asAdmin()->get('/ajax/tags/suggest/values?search=ora')->assertExactJson([]);
|
$this->asAdmin()->get('/ajax/tags/suggest/values?search=ora')->assertSimilarJson([]);
|
||||||
$this->get('/ajax/tags/suggest/values?search=cat')->assertExactJson(['cats', 'cattery', 'catapult']);
|
$this->get('/ajax/tags/suggest/values?search=cat')->assertSimilarJson(['cats', 'cattery', 'catapult']);
|
||||||
$this->get('/ajax/tags/suggest/values?search=do')->assertExactJson(['dog', 'dodgy']);
|
$this->get('/ajax/tags/suggest/values?search=do')->assertSimilarJson(['dog', 'dodgy']);
|
||||||
$this->get('/ajax/tags/suggest/values?search=cas')->assertExactJson(['castle']);
|
$this->get('/ajax/tags/suggest/values?search=cas')->assertSimilarJson(['castle']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_entity_permissions_effect_tag_suggestions()
|
public function test_entity_permissions_effect_tag_suggestions()
|
||||||
{
|
{
|
||||||
// Create some tags with similar names to test with and save to a page
|
// Create some tags with similar names to test with and save to a page
|
||||||
$attrs = collect();
|
$attrs = collect();
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'country']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'color']));
|
$attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'color']));
|
||||||
$page = $this->getEntityWithTags(Page::class, $attrs->all());
|
$page = $this->getEntityWithTags(Page::class, $attrs->all());
|
||||||
|
|
||||||
$this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country']);
|
$this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson(['color', 'country']);
|
||||||
$this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country']);
|
$this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson(['color', 'country']);
|
||||||
|
|
||||||
// Set restricted permission the page
|
// Set restricted permission the page
|
||||||
$page->restricted = true;
|
$page->restricted = true;
|
||||||
$page->save();
|
$page->save();
|
||||||
$page->rebuildPermissions();
|
$page->rebuildPermissions();
|
||||||
|
|
||||||
$this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country']);
|
$this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson(['color', 'country']);
|
||||||
$this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertExactJson([]);
|
$this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_tags_shown_on_search_listing()
|
public function test_tags_shown_on_search_listing()
|
||||||
{
|
{
|
||||||
$tags = [
|
$tags = [
|
||||||
factory(Tag::class)->make(['name' => 'category', 'value' => 'buckets']),
|
Tag::factory()->make(['name' => 'category', 'value' => 'buckets']),
|
||||||
factory(Tag::class)->make(['name' => 'color', 'value' => 'red']),
|
Tag::factory()->make(['name' => 'color', 'value' => 'red']),
|
||||||
];
|
];
|
||||||
|
|
||||||
$page = $this->getEntityWithTags(Page::class, $tags);
|
$page = $this->getEntityWithTags(Page::class, $tags);
|
||||||
|
@ -167,7 +167,7 @@ class HomepageTest extends TestCase
|
|||||||
|
|
||||||
public function test_new_users_dont_have_any_recently_viewed()
|
public function test_new_users_dont_have_any_recently_viewed()
|
||||||
{
|
{
|
||||||
$user = factory(User::class)->create();
|
$user = User::factory()->create();
|
||||||
$viewRole = Role::getRole('Viewer');
|
$viewRole = Role::getRole('Viewer');
|
||||||
$user->attachRole($viewRole);
|
$user->attachRole($viewRole);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class LanguageTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* LanguageTest constructor.
|
* LanguageTest constructor.
|
||||||
*/
|
*/
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
|
$this->langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
|
||||||
|
@ -23,7 +23,7 @@ class EntityPermissionsTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
protected $viewer;
|
protected $viewer;
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->user = $this->getEditor();
|
$this->user = $this->getEditor();
|
||||||
|
@ -19,7 +19,7 @@ class RolesTest extends TestCase
|
|||||||
{
|
{
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->user = $this->getViewer();
|
$this->user = $this->getViewer();
|
||||||
@ -769,7 +769,7 @@ class RolesTest extends TestCase
|
|||||||
$this->giveUserPermissions($this->user, ['image-update-all']);
|
$this->giveUserPermissions($this->user, ['image-update-all']);
|
||||||
/** @var Page $page */
|
/** @var Page $page */
|
||||||
$page = Page::query()->first();
|
$page = Page::query()->first();
|
||||||
$image = factory(Image::class)->create([
|
$image = Image::factory()->create([
|
||||||
'uploaded_to' => $page->id,
|
'uploaded_to' => $page->id,
|
||||||
'created_by' => $this->user->id,
|
'created_by' => $this->user->id,
|
||||||
'updated_by' => $this->user->id,
|
'updated_by' => $this->user->id,
|
||||||
@ -789,7 +789,7 @@ class RolesTest extends TestCase
|
|||||||
$admin = $this->getAdmin();
|
$admin = $this->getAdmin();
|
||||||
/** @var Page $page */
|
/** @var Page $page */
|
||||||
$page = Page::query()->first();
|
$page = Page::query()->first();
|
||||||
$image = factory(Image::class)->create(['uploaded_to' => $page->id, 'created_by' => $admin->id, 'updated_by' => $admin->id]);
|
$image = Image::factory()->create(['uploaded_to' => $page->id, 'created_by' => $admin->id, 'updated_by' => $admin->id]);
|
||||||
|
|
||||||
$this->actingAs($this->user)->json('delete', '/images/' . $image->id)->assertStatus(403);
|
$this->actingAs($this->user)->json('delete', '/images/' . $image->id)->assertStatus(403);
|
||||||
|
|
||||||
@ -825,14 +825,14 @@ class RolesTest extends TestCase
|
|||||||
{
|
{
|
||||||
$admin = $this->getAdmin();
|
$admin = $this->getAdmin();
|
||||||
// Book links
|
// Book links
|
||||||
$book = factory(Book::class)->create(['created_by' => $admin->id, 'updated_by' => $admin->id]);
|
$book = Book::factory()->create(['created_by' => $admin->id, 'updated_by' => $admin->id]);
|
||||||
$this->regenEntityPermissions($book);
|
$this->regenEntityPermissions($book);
|
||||||
$this->actingAs($this->getViewer())->get($book->getUrl())
|
$this->actingAs($this->getViewer())->get($book->getUrl())
|
||||||
->assertDontSee('Create a new page')
|
->assertDontSee('Create a new page')
|
||||||
->assertDontSee('Add a chapter');
|
->assertDontSee('Add a chapter');
|
||||||
|
|
||||||
// Chapter links
|
// Chapter links
|
||||||
$chapter = factory(Chapter::class)->create(['created_by' => $admin->id, 'updated_by' => $admin->id, 'book_id' => $book->id]);
|
$chapter = Chapter::factory()->create(['created_by' => $admin->id, 'updated_by' => $admin->id, 'book_id' => $book->id]);
|
||||||
$this->regenEntityPermissions($chapter);
|
$this->regenEntityPermissions($chapter);
|
||||||
$this->actingAs($this->getViewer())->get($chapter->getUrl())
|
$this->actingAs($this->getViewer())->get($chapter->getUrl())
|
||||||
->assertDontSee('Create a new page')
|
->assertDontSee('Create a new page')
|
||||||
@ -926,14 +926,14 @@ class RolesTest extends TestCase
|
|||||||
|
|
||||||
private function addComment(Page $page): TestResponse
|
private function addComment(Page $page): TestResponse
|
||||||
{
|
{
|
||||||
$comment = factory(Comment::class)->make();
|
$comment = Comment::factory()->make();
|
||||||
|
|
||||||
return $this->postJson("/comment/$page->id", $comment->only('text', 'html'));
|
return $this->postJson("/comment/$page->id", $comment->only('text', 'html'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateComment(Comment $comment): TestResponse
|
private function updateComment(Comment $comment): TestResponse
|
||||||
{
|
{
|
||||||
$commentData = factory(Comment::class)->make();
|
$commentData = Comment::factory()->make();
|
||||||
|
|
||||||
return $this->putJson("/comment/{$comment->id}", $commentData->only('text', 'html'));
|
return $this->putJson("/comment/{$comment->id}", $commentData->only('text', 'html'));
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ trait SharedTestHelpers
|
|||||||
protected function createNewRole(array $permissions = []): Role
|
protected function createNewRole(array $permissions = []): Role
|
||||||
{
|
{
|
||||||
$permissionRepo = app(PermissionsRepo::class);
|
$permissionRepo = app(PermissionsRepo::class);
|
||||||
$roleData = factory(Role::class)->make()->toArray();
|
$roleData = Role::factory()->make()->toArray();
|
||||||
$roleData['permissions'] = array_flip($permissions);
|
$roleData['permissions'] = array_flip($permissions);
|
||||||
|
|
||||||
return $permissionRepo->saveNewRole($roleData);
|
return $permissionRepo->saveNewRole($roleData);
|
||||||
@ -228,9 +228,9 @@ trait SharedTestHelpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
$userAttrs = ['created_by' => $creatorUser->id, 'owned_by' => $creatorUser->id, 'updated_by' => $updaterUser->id];
|
$userAttrs = ['created_by' => $creatorUser->id, 'owned_by' => $creatorUser->id, 'updated_by' => $updaterUser->id];
|
||||||
$book = factory(Book::class)->create($userAttrs);
|
$book = Book::factory()->create($userAttrs);
|
||||||
$chapter = factory(Chapter::class)->create(array_merge(['book_id' => $book->id], $userAttrs));
|
$chapter = Chapter::factory()->create(array_merge(['book_id' => $book->id], $userAttrs));
|
||||||
$page = factory(Page::class)->create(array_merge(['book_id' => $book->id, 'chapter_id' => $chapter->id], $userAttrs));
|
$page = Page::factory()->create(array_merge(['book_id' => $book->id, 'chapter_id' => $chapter->id], $userAttrs));
|
||||||
$restrictionService = $this->app[PermissionService::class];
|
$restrictionService = $this->app[PermissionService::class];
|
||||||
$restrictionService->buildJointPermissionsForEntity($book);
|
$restrictionService->buildJointPermissionsForEntity($book);
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class ThemeTest extends TestCase
|
|||||||
Theme::listen(ThemeEvents::AUTH_REGISTER, $callback);
|
Theme::listen(ThemeEvents::AUTH_REGISTER, $callback);
|
||||||
$this->setSettings(['registration-enabled' => 'true']);
|
$this->setSettings(['registration-enabled' => 'true']);
|
||||||
|
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
$this->post('/register', ['email' => $user->email, 'name' => $user->name, 'password' => 'password']);
|
$this->post('/register', ['email' => $user->email, 'name' => $user->name, 'password' => 'password']);
|
||||||
|
|
||||||
$this->assertCount(2, $args);
|
$this->assertCount(2, $args);
|
||||||
|
@ -42,7 +42,7 @@ class AvatarTest extends TestCase
|
|||||||
config()->set([
|
config()->set([
|
||||||
'services.disable_services' => false,
|
'services.disable_services' => false,
|
||||||
]);
|
]);
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
$this->assertImageFetchFrom('https://www.gravatar.com/avatar/' . md5(strtolower($user->email)) . '?s=500&d=identicon');
|
$this->assertImageFetchFrom('https://www.gravatar.com/avatar/' . md5(strtolower($user->email)) . '?s=500&d=identicon');
|
||||||
|
|
||||||
$user = $this->createUserRequest($user);
|
$user = $this->createUserRequest($user);
|
||||||
@ -60,7 +60,7 @@ class AvatarTest extends TestCase
|
|||||||
'services.avatar_url' => 'https://example.com/${email}/${hash}/${size}',
|
'services.avatar_url' => 'https://example.com/${email}/${hash}/${size}',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
$url = 'https://example.com/' . urlencode(strtolower($user->email)) . '/' . md5(strtolower($user->email)) . '/500';
|
$url = 'https://example.com/' . urlencode(strtolower($user->email)) . '/' . md5(strtolower($user->email)) . '/500';
|
||||||
$this->assertImageFetchFrom($url);
|
$this->assertImageFetchFrom($url);
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class AvatarTest extends TestCase
|
|||||||
'services.disable_services' => true,
|
'services.disable_services' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
|
|
||||||
$http = $this->mock(HttpFetcher::class);
|
$http = $this->mock(HttpFetcher::class);
|
||||||
$http->shouldNotReceive('fetch');
|
$http->shouldNotReceive('fetch');
|
||||||
@ -93,7 +93,7 @@ class AvatarTest extends TestCase
|
|||||||
|
|
||||||
$logger = $this->withTestLogger();
|
$logger = $this->withTestLogger();
|
||||||
|
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
$this->createUserRequest($user);
|
$this->createUserRequest($user);
|
||||||
$this->assertTrue($logger->hasError('Failed to save user avatar image'));
|
$this->assertTrue($logger->hasError('Failed to save user avatar image'));
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class UserManagementTest extends TestCase
|
|||||||
public function test_user_creation()
|
public function test_user_creation()
|
||||||
{
|
{
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = factory(User::class)->make();
|
$user = User::factory()->make();
|
||||||
$adminRole = Role::getRole('admin');
|
$adminRole = Role::getRole('admin');
|
||||||
|
|
||||||
$resp = $this->asAdmin()->get('/settings/users');
|
$resp = $this->asAdmin()->get('/settings/users');
|
||||||
|
@ -14,7 +14,7 @@ class UserProfileTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
public function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->user = User::all()->last();
|
$this->user = User::all()->last();
|
||||||
@ -42,7 +42,7 @@ class UserProfileTest extends TestCase
|
|||||||
|
|
||||||
public function test_profile_page_shows_created_content_counts()
|
public function test_profile_page_shows_created_content_counts()
|
||||||
{
|
{
|
||||||
$newUser = factory(User::class)->create();
|
$newUser = User::factory()->create();
|
||||||
|
|
||||||
$this->asAdmin()->get('/user/' . $newUser->slug)
|
$this->asAdmin()->get('/user/' . $newUser->slug)
|
||||||
->assertSee($newUser->name)
|
->assertSee($newUser->name)
|
||||||
@ -61,7 +61,7 @@ class UserProfileTest extends TestCase
|
|||||||
|
|
||||||
public function test_profile_page_shows_recent_activity()
|
public function test_profile_page_shows_recent_activity()
|
||||||
{
|
{
|
||||||
$newUser = factory(User::class)->create();
|
$newUser = User::factory()->create();
|
||||||
$this->actingAs($newUser);
|
$this->actingAs($newUser);
|
||||||
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
|
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
|
||||||
Activity::addForEntity($entities['book'], ActivityType::BOOK_UPDATE);
|
Activity::addForEntity($entities['book'], ActivityType::BOOK_UPDATE);
|
||||||
@ -75,7 +75,7 @@ class UserProfileTest extends TestCase
|
|||||||
|
|
||||||
public function test_user_activity_has_link_leading_to_profile()
|
public function test_user_activity_has_link_leading_to_profile()
|
||||||
{
|
{
|
||||||
$newUser = factory(User::class)->create();
|
$newUser = User::factory()->create();
|
||||||
$this->actingAs($newUser);
|
$this->actingAs($newUser);
|
||||||
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
|
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
|
||||||
Activity::addForEntity($entities['book'], ActivityType::BOOK_UPDATE);
|
Activity::addForEntity($entities['book'], ActivityType::BOOK_UPDATE);
|
||||||
|
Loading…
Reference in New Issue
Block a user