phplaravellaravel-backpack

Backpack for Laravel: Permission to see add ons


if I would want to hide a specific add-on, e.g. the LangFileManager or PermissionManager itself, conditionally by using a permission (PermissionManager -> can('use module'). How would I do that?

I can't register a middleware / routes or crud->denyAccess(), as they are pre-defined in the add-ons.

I want to return a 403, if the user does not have the permission.

Thanks in advance.


Solution

  • Backpack does not have the notion of "roles" or "permissions", that's something that your application have specifically (by optionally adding the permission manager).

    If you want to configure permission manager "crud panels", you need to create your own UserCrudController in your app, adding there your customizations on top of the package.

    Apart from setting up access, you can also add/remove fields, etc as in any other CrudController.

    Here are the docs on how to do it: https://github.com/Laravel-Backpack/PermissionManager?tab=readme-ov-file#customize-usercrudcontroller

    If you have any issues, feel free to open a question in our community-forum https://github.com/Laravel-Backpack/community-forum/discussions/

    Cheers