diff --git a/app/Actions/Webhook.php b/app/Actions/Webhook.php
new file mode 100644
index 000000000..6939b54d6
--- /dev/null
+++ b/app/Actions/Webhook.php
@@ -0,0 +1,11 @@
+checkPermission('user-roles-manage');
$roles = $this->permissionsRepo->getAllRoles();
diff --git a/app/Http/Controllers/WebhookController.php b/app/Http/Controllers/WebhookController.php
new file mode 100644
index 000000000..8745bf91d
--- /dev/null
+++ b/app/Http/Controllers/WebhookController.php
@@ -0,0 +1,16 @@
+ 'My webhook for ' . $this->faker->country(),
+ 'endpoint' => $this->faker->url,
+ ];
+ }
+}
diff --git a/database/migrations/2021_12_07_111343_create_webhooks_table.php b/database/migrations/2021_12_07_111343_create_webhooks_table.php
new file mode 100644
index 000000000..7ccfe693d
--- /dev/null
+++ b/database/migrations/2021_12_07_111343_create_webhooks_table.php
@@ -0,0 +1,33 @@
+increments('id');
+ $table->string('name', 150);
+ $table->string('endpoint', 500);
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('webhooks');
+ }
+}
diff --git a/resources/icons/webhooks.svg b/resources/icons/webhooks.svg
new file mode 100644
index 000000000..fff081413
--- /dev/null
+++ b/resources/icons/webhooks.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php
index 688b0aad8..57cbe500e 100755
--- a/resources/lang/en/settings.php
+++ b/resources/lang/en/settings.php
@@ -233,6 +233,10 @@ return [
'user_api_token_delete_confirm' => 'Are you sure you want to delete this API token?',
'user_api_token_delete_success' => 'API token successfully deleted',
+ // Webhooks
+ 'webhooks' => 'Webhooks',
+ 'webhooks_create' => 'Create New Webhook',
+
//! If editing translations files directly please ignore this in all
//! languages apart from en. Content will be auto-copied from en.
//!////////////////////////////////
diff --git a/resources/views/settings/audit.blade.php b/resources/views/settings/audit.blade.php
index 84f180f3b..9261ed61b 100644
--- a/resources/views/settings/audit.blade.php
+++ b/resources/views/settings/audit.blade.php
@@ -10,7 +10,7 @@
-
{{ trans('settings.audit') }}
+
{{ trans('settings.audit') }}
{{ trans('settings.audit_desc') }}
diff --git a/resources/views/settings/parts/navbar-with-version.blade.php b/resources/views/settings/parts/navbar-with-version.blade.php
index 09af699a3..bec41146b 100644
--- a/resources/views/settings/parts/navbar-with-version.blade.php
+++ b/resources/views/settings/parts/navbar-with-version.blade.php
@@ -6,10 +6,12 @@ $version - Version of bookstack to display
@include('settings.parts.navbar', ['selected' => $selected])
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/settings/parts/navbar.blade.php b/resources/views/settings/parts/navbar.blade.php
index a472196c5..f2fad378c 100644
--- a/resources/views/settings/parts/navbar.blade.php
+++ b/resources/views/settings/parts/navbar.blade.php
@@ -13,4 +13,7 @@
@if(userCan('user-roles-manage'))
@icon('lock-open'){{ trans('settings.roles') }}
@endif
+ @if(userCan('settings-manage'))
+
@icon('webhooks'){{ trans('settings.webhooks') }}
+ @endif
\ No newline at end of file
diff --git a/resources/views/settings/webhooks/index.blade.php b/resources/views/settings/webhooks/index.blade.php
new file mode 100644
index 000000000..ca93cfeb0
--- /dev/null
+++ b/resources/views/settings/webhooks/index.blade.php
@@ -0,0 +1,25 @@
+@extends('layouts.simple')
+
+@section('body')
+
+
+
+
+ @include('settings.parts.navbar', ['selected' => 'webhooks'])
+
+
+
+
+
+
{{ trans('settings.webhooks') }}
+
+
+
+
+
+
+
+
+@stop
diff --git a/routes/web.php b/routes/web.php
index c924ed68c..627ce6523 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -29,7 +29,11 @@ use BookStack\Http\Controllers\UserApiTokenController;
use BookStack\Http\Controllers\UserController;
use BookStack\Http\Controllers\UserProfileController;
use BookStack\Http\Controllers\UserSearchController;
+use BookStack\Http\Controllers\WebhookController;
+use BookStack\Http\Middleware\VerifyCsrfToken;
+use Illuminate\Session\Middleware\StartSession;
use Illuminate\Support\Facades\Route;
+use Illuminate\View\Middleware\ShareErrorsFromSession;
Route::get('/status', [StatusController::class, 'show']);
Route::get('/robots.txt', [HomeController::class, 'robots']);
@@ -244,13 +248,16 @@ Route::middleware('auth')->group(function () {
Route::delete('/settings/users/{userId}/api-tokens/{tokenId}', [UserApiTokenController::class, 'destroy']);
// Roles
- Route::get('/settings/roles', [RoleController::class, 'list']);
+ Route::get('/settings/roles', [RoleController::class, 'index']);
Route::get('/settings/roles/new', [RoleController::class, 'create']);
Route::post('/settings/roles/new', [RoleController::class, 'store']);
Route::get('/settings/roles/delete/{id}', [RoleController::class, 'showDelete']);
Route::delete('/settings/roles/delete/{id}', [RoleController::class, 'delete']);
Route::get('/settings/roles/{id}', [RoleController::class, 'edit']);
Route::put('/settings/roles/{id}', [RoleController::class, 'update']);
+
+ // Webhooks
+ Route::get('/settings/webhooks', [WebhookController::class, 'index']);
});
// MFA routes
@@ -291,9 +298,9 @@ Route::post('/saml2/logout', [Auth\Saml2Controller::class, 'logout']);
Route::get('/saml2/metadata', [Auth\Saml2Controller::class, 'metadata']);
Route::get('/saml2/sls', [Auth\Saml2Controller::class, 'sls']);
Route::post('/saml2/acs', [Auth\Saml2Controller::class, 'startAcs'])->withoutMiddleware([
- \Illuminate\Session\Middleware\StartSession::class,
- \Illuminate\View\Middleware\ShareErrorsFromSession::class,
- \BookStack\Http\Middleware\VerifyCsrfToken::class,
+ StartSession::class,
+ ShareErrorsFromSession::class,
+ VerifyCsrfToken::class,
]);
Route::get('/saml2/acs', [Auth\Saml2Controller::class, 'processAcs']);