-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Security Annotation Driven Weighted N-Level Bootstrap Menus #320
Comments
the bundle is intended to use your existing firewall's configuration , so you don't need to add extra configuration for the menu, or if you are using
|
|
|
I want to be able to make Bar "heavier by weight" than Foo , so I assign Foo Weight=20, and Bar Weight=30 $menu->addChild('Foo', array('route' => 'user_home', 'icon' => 'list-alt'))->setExtra('weight', 20);
$menu->addChild('Bar', array('route' => 'user_home', 'icon' => 'list-alt'))->setExtra('weight', 30);
Can I help with documentation or developing examples or testing (not writing code based Tests) ? |
As far as I can remember Knp Bundle was showing the menu as you declared, not modifying the order in any way (maybe that was time ago when I create this plugin). It will take a while until I can address this changes, but I'll do. |
That's wrong. KnpMenu does not sort the menu at all. It displays items in the order in which you added them (unless you reorder them after that of course, but the library won't reorder anything for you) |
@zetta and @stof I have fixed my comment. I thought I saw somewhere that it was filtering by name but I have been looking through several bundles, gists's , tutorials, and discussions so thank you for the clarification on my (I believe) statement. @stof do you think KNPMenu/KNPMenuBundle will ever integrate weights/user access? @zetta , thank you for being open to input and for implementing these features! What is your time estimate to add these features? I only ask so I can work on other aspects of my project around your schedule. Let me know if I can be of any help! |
Goals
I would like to have a menu that is responsive to both itself->(weights) but also responsive to its enviornment->(security) , have N-Levels, showActiveclass, N-Level(active class), Extended by Other Bundles through Events, and of course has top performance/caching.
Current Enviornment / Approach
Symfony: 3.0.5 and will be upgrading to 3.1.
SensioFrameWorkExtraBundle: 3.0.16
KNPMenuBundle: 2.1.1
MopaBootstrapBundle: 3.0.0 - master @dev
A) Implementing KNPMenuBundle Menu Builder as a Service
B) Implemented an Event Driven KNPMenuBundle Menu
C) For performance I recommend disabling your unused KNPMenuBundle Menu Providers as it boosts performance.
References for the Two Filter Options
Note: This tutorial is Pre Symfony 2.6 due to the use of security.context service). I have updated my solution to take advantage of constructor injection of the service arguments '@security.token_storage' and '@security.authorization_checker' to the menu builder service(also an update to the tutorial) AND if you use event listeners or subscribers to extend your menu injecting the services in there will allow you further control. (Is the security injection best practices? -- discussed below)
Concerns with the Implementation
1. Is Filtering by Weight already possible in a merged commit into KNPMenu?
A. #176 - referred to (Mar 11, 2013) [KNPMenu Issue#97(https://github.com/KnpLabs/KnpMenu/issues/97) - Fixed Via (Jun 24, 2015) @folliked PR #209 Commit
B. KNPMenu PR#207 by @NiR- referencing Issue #97.
C. Sorting From Different Bundles requires using subscriber versus listener as noted here by @TomasVotruba
D. Gitter
E. #118
Filter by Weight Potentially Interested Developers(due to your participation on these Issues/PR's etc): @khal3d , @Nek- , @benjamindulau, @ Maxwell2022 , @dbu , @NiR- , @althaus, @Naitsirch
@stof
2. Filter by Current User Access
A) Symfony says
@Security
is the best practice to use when possible however he tutorial calls for [JMSSecurityExtraBundle}(https://github.com/schmittjoh/JMSSecurityExtraBundle) which requires the@Secure
Annotations NOT the@Security
annotations.B. According to @dustin10 (Nov 1, 2011) in #83 it is best to inject into the builder and USE IF/ELSE
C. According to @stof (Jul 15, 2011) and @jared-fraser (Jan 5, 2012) in #51 they also say it is best to inject into the builder and use IF/ELSE.
D. Another Option that was not integrated due to the nature of the implementation - config file based role/expression filtering (https://github.com//pull/243).
E. There are other options on the Market however they also require JMSSecurityExtraBundle, and both do not seem to be cacheable, and limit the usage of the full security that JMSSecurityExtraBundle has to offer especially expressions, voters.
Other Available Solutions To Filter By User Roles
Filter by User Roles Potentially Interested Developers(due to your participation on these Issues/PR's, or the Bundles you contribute to or developed the etc): @zerkalica
@stof
Requirements
The solution must:
General Components For The Solution
Approach Thought Process
Perceived Choices
Can you please help @stof @fabpot @schmittjoh , @tvlooy, and the rest of everyone mentioned in this inquiry to come up with a solution with me if you agree with the needs and potential other uses of the potential changes (FilterInterface, SenseioAnnotationDriver/CustomAnnotationDriver) etc?
Disclaimers
Please excuse the format of my post. I am trying to make a well organized, detailed inquiry that is clear, searchable, and contains enough information and gets the right people involved.
The text was updated successfully, but these errors were encountered: