Giter Site home page Giter Site logo

Comments (7)

micraux avatar micraux commented on June 11, 2024 1

You're welcome!

I don't think it would be an improvement to create all policies based on models because:

  • you may want to use Filament only with certain models and not all your application models
  • you may have created your own policies for your front app and do not want Shield to replace them
  • and maybe other reasons I don't see right now...

Remember that Filament was originally created to make an admin, not to be a full app.

That is why (I suppose) Shield only generates policies for models with a resource.

from filament-shield.

micraux avatar micraux commented on June 11, 2024

Hi,

I don't really understand your problem...

As far as I know, permissions and policies aren't relationship-related.

Are you trying to use permissions on a relation manager?

from filament-shield.

bamod33 avatar bamod33 commented on June 11, 2024

The problem is that php artisan shield:install does not create permissions for the model that is being related in the RelationManager, so the relationship does not appear in the panel.

When I launch install, it generates permissions for all models, but it does not create permissions for models that are linked through a RelationManager (i.e. those that are used through a pivot).

Model A <- PIVOT -> MODEL B

The policy for MODEL B is not generated, and therefore does not appear in the panel.

from filament-shield.

micraux avatar micraux commented on June 11, 2024

Did you create a resource for MODEL B?

from filament-shield.

bamod33 avatar bamod33 commented on June 11, 2024

Did you create a resource for MODEL B?

No I didn't, cause I don't want to have a dedicated resource for model B

from filament-shield.

micraux avatar micraux commented on June 11, 2024

That is why Shield didn't generate your MODEL B policy.

You need the MODEL B resource if you want Shield to create the MODEL B policy, and if you do not want this resource to appear in your navigation, you can add this line:

// Add this line to your ModelbResource.php file
protected static bool $shouldRegisterNavigation = false;

from filament-shield.

bamod33 avatar bamod33 commented on June 11, 2024

Hi @micraux

That works, but I feel that way a little tricky. Maybe as a future improvement the plugin could search for this kind of relations that doesn't have a dedicated Resource

Anyway, thanks for the help :)

from filament-shield.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.