Skip to content

Is overwriting PermissionFilter possible? #763

Answered by kenjis
yassinedoghri asked this question in Q&A
Discussion options

You must be logged in to vote

Registrar is a feature to add or overwrite app/Config/* settings.
There is no way to disable a specific Registrar.

  1. You can overwrite it after Registrar works.
--- a/app/Config/Filters.php
+++ b/app/Config/Filters.php
@@ -61,4 +61,11 @@ class Filters extends BaseConfig
      * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
      */
     public array $filters = [];
+
+    public function __construct()
+    {
+        parent::__construct(); // Registrar works in this constructor.
+
+        $this->aliases['permission'] = 'App\Filters\PermissionFilter';
+    }
 }
  1. You can disable Auto-discovery of Registrars.
    But if you disable it, you need to add all config items that all packag…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yassinedoghri
Comment options

Answer selected by yassinedoghri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants