Menus per Permission
Swader opened this issue · 8 comments
Would be awesome to be able to attach different menu combinations to different roles / users / permissions. This would let a user see only the menu they're supposed to see, automatically, without additional checks in the template etc.
Any chance for such a feature before 5.5.?
+1
However, this package is somewhat detached from any other generic permission system.
PRs are welcome but if a PR is a little too much work, even a short discussion with simply what the API might look like may help determine if one is worth putting up.
Hey all,
@lloy0076 I just implemented this on a project i just started.
Multiple menus (top and/or sidebar), with Filters, means using existins GateFilter, or implement one of your taste (for eg. Sentinel)
@lloy0076 should I send you a working project zip, or how to make PR? First I need to fork?
developer for many years, first time contributor here :)
@Swader I think that's beyond the scope of MenuCRUD. It was only ever meant to be a simple example, that you can build upon. I usually don't even install it as-is, but copy-paste the files into my projects and modify as I please. The reason I say this would be out of scope is because not all Backpack installations use PermissionManager. Some don't need it. So complicating MenuCRUD would make it more difficult for the simple use cases.
@ijpatricio that sounds great. I don't think this is something that we'd include in the current MenuCRUD - I'd rather it is very very simple and people add stuff to it when needed. So I don't think you should work on a PR. But thank you. The best way to contribute with your work and experience, I think, would be to fork this MenuCRUD into... let's say... PermissionMenuCRUD, and do all your modifs there. I would be happy to promote your new package within the Backpack community then. We actually plan on having a bigger ecosystem for Backpack packages, and multiple choices for a Menu package sounds good to me :-) What do you think?
Thanks. Cheers!
@tabacitu that sounds great also! will do. i'll find some free time soon, say, in one week, is that good timing? don't want to be doubling efforts with someone else
so i'll make it db-first, but with option (repository pattern) to get from DB, or source code (hard coded collection). well, with such pattern, doesn't matter :) permissionMenuService receives a Collection instance, and goes from there. FilterService, filters out links based on defined and allowed permissions/gates/manually defined filters
sounds good?
@lloy0076 thanks for the direction!
@ijpatricio sounds good. I recommend you prototype a solution, put it out there and get feedback on Backpack's Gitter. I found people usually rally around solutions they need - if you manage to find a few people with the same problem as you that take a look at the code - I promise they'll find solutions you haven't even thought about :-) That's how Backpack got to what it is today.
Cheers!