Ho to build dynamic menus based on user roles/permissions |
I've been developing for long time on top of framework like Symfony2 and Laravel that I don't have a clue about what I will be asking and sounds like a dummy question for old developers but ....
I am starting a new simple application and I will be using: IonAuth for authentication/authorization and I was thinking in KnpMenu for built dynamic menus (I am open to suggestion for this one since I don't know to much packages for CI just yet) Since the menus should be based on roles/permission the idea is:
This "query the database, find the proper items and built the menu" should be the first code executed before every page load or maybe I should use another mechanism for just make this one time (after successful login) (again I am open to suggestion to this one as well). So my question is, how would you handle this?
I have a "navigation bar" library which performs the queries and organizes data the way I need to. Then I can call this library from anywhere
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
@albertleao "You have"? Can you share it so I can take a look and probably use it on my app?
Unfortunately, I am legally obligated to say no. Sharing my companys code is a big no no.
What I can do is recommend that you write a simple library with a function such as getNavigation(); You can instantiate the library and pass in the user and create the nav from there.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
(07-28-2016, 06:07 PM)albertleao Wrote: Unfortunately, I am legally obligated to say no. Sharing my companys code is a big no no. No problem, can you share at least a piece of code or an example in how to create and register a library? That's all I need to understand now since the "how to" is how I said and probably I will attach your answer as well
Oooopppppssss nvm sorry for ask that I've found the docs and seems to be pretty good, I will come back if I need your help, for now thank you
No problem.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
|
Welcome Guest, Not a member yet? Register Sign In |