]> BookStack Code Mirror - bookstack/blobdiff - app/Theming/ThemeEvents.php
Customization: Added parent tag classes
[bookstack] / app / Theming / ThemeEvents.php
index aacef80cfd29117c284398f9d2d695e20db52eef..2d4900c962cb1cf690bad1d12bc6899cbda799d7 100644 (file)
@@ -2,8 +2,6 @@
 
 namespace BookStack\Theming;
 
-use BookStack\Entities\Models\Page;
-
 /**
  * The ThemeEvents used within BookStack.
  *
@@ -25,8 +23,8 @@ class ThemeEvents
      * The provided $detail can be a string or a loggable type of model. You should check
      * the type before making use of this parameter.
      *
-     * @param string                                $type
-     * @param string|\BookStack\Interfaces\Loggable $detail
+     * @param string $type
+     * @param string|\BookStack\Activity\Models\Loggable $detail
      */
     const ACTIVITY_LOGGED = 'activity_logged';
 
@@ -34,7 +32,7 @@ class ThemeEvents
      * Application boot-up.
      * After main services are registered.
      *
-     * @param \BookStack\Application $app
+     * @param \BookStack\App\Application $app
      */
     const APP_BOOT = 'app_boot';
 
@@ -44,19 +42,38 @@ class ThemeEvents
      * system as a standard app user. This includes a user becoming logged in
      * after registration. This is not emitted upon API usage.
      *
-     * @param string               $authSystem
-     * @param \BookStack\Auth\User $user
+     * @param string $authSystem
+     * @param \BookStack\Users\Models\User $user
      */
     const AUTH_LOGIN = 'auth_login';
 
+    /**
+     * Auth pre-register event.
+     * Runs right before a new user account is registered in the system by any authentication
+     * system as a standard app user including auto-registration systems used by LDAP,
+     * SAML, OIDC and social systems. It only includes self-registrations,
+     * not accounts created by others in the UI or via the REST API.
+     * It runs after any other normal validation steps.
+     * Any account/email confirmation occurs post-registration.
+     * The provided $userData contains the main details that would be used to create
+     * the account, and may depend on authentication method.
+     * If false is returned from the event, registration will be prevented and the user
+     * will be returned to the login page.
+     *
+     * @param string $authSystem
+     * @param array $userData
+     * @returns bool|null
+     */
+    const AUTH_PRE_REGISTER = 'auth_pre_register';
+
     /**
      * Auth register event.
      * Runs right after a user is newly registered to the application by any authentication
      * system as a standard app user. This includes auto-registration systems used
-     * by LDAP, SAML and social systems. It only includes self-registrations.
+     * by LDAP, SAML, OIDC and social systems. It only includes self-registrations.
      *
-     * @param string               $authSystem
-     * @param \BookStack\Auth\User $user
+     * @param string $authSystem
+     * @param \BookStack\Users\Models\User $user
      */
     const AUTH_REGISTER = 'auth_register';
 
@@ -93,11 +110,30 @@ class ThemeEvents
      *
      * @param string $tagReference
      * @param string $replacementHTML
-     * @param Page   $currentPage
-     * @param ?Page  $referencedPage
+     * @param \BookStack\Entities\Models\Page $currentPage
+     * @param ?\BookStack\Entities\Models\Page $referencedPage
      */
     const PAGE_INCLUDE_PARSE = 'page_include_parse';
 
+    /**
+     * Routes register web event.
+     * Called when standard web (browser/non-api) app routes are registered.
+     * Provides an app router, so you can register your own web routes.
+     *
+     * @param \Illuminate\Routing\Router $router
+     */
+    const ROUTES_REGISTER_WEB = 'routes_register_web';
+
+    /**
+     * Routes register web auth event.
+     * Called when auth-required web (browser/non-api) app routes can be registered.
+     * These are routes that typically require login to access (unless the instance is made public).
+     * Provides an app router, so you can register your own web routes.
+     *
+     * @param \Illuminate\Routing\Router $router
+     */
+    const ROUTES_REGISTER_WEB_AUTH = 'routes_register_web_auth';
+
     /**
      * Web before middleware action.
      * Runs before the request is handled but after all other middleware apart from those
@@ -116,7 +152,7 @@ class ThemeEvents
      * Provides both the original request and the currently resolved response.
      * Return values, if provided, will be used as a new response to use.
      *
-     * @param \Illuminate\Http\Request                                                       $request
+     * @param \Illuminate\Http\Request $request
      * @param \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\BinaryFileResponse $response
      * @returns \Illuminate\Http\Response|null
      */
@@ -132,11 +168,12 @@ class ThemeEvents
      * If the listener returns a non-null value, that will be used as the POST data instead
      * of the system default.
      *
-     * @param string                                $event
-     * @param \BookStack\Actions\Webhook            $webhook
-     * @param string|\BookStack\Interfaces\Loggable $detail
-     * @param \BookStack\Auth\User                  $initiator
-     * @param int                                   $initiatedTime
+     * @param string $event
+     * @param \BookStack\Activity\Models\Webhook $webhook
+     * @param string|\BookStack\Activity\Models\Loggable $detail
+     * @param \BookStack\Users\Models\User $initiator
+     * @param int $initiatedTime
+     * @returns array|null
      */
     const WEBHOOK_CALL_BEFORE = 'webhook_call_before';
 }