I have to build a pretty complex application using Backbone Marionette. The user interface has to handle multiple users with different roles. For example the ‘admin’ user will see the complete menu whereas the ‘guest’ user will access a subset of the same menu. Moreover some views will be accessible to all the users but the functions inside them (add, edit, delete) need to be profiled on the different roles.
I am not sure about the right approach to use in order to solve this issue. I could have different templates for the different roles but in this case plenty of code will be duplicated inside them. Is there any best practice (or maybe some example) to sort my problem out using Marionette?
Thanks in advance,
Fabrizio
I would keep a mypermissions object and then write logic in the itemview to handle the different cases. You can make a CSS class called “hide” that is set to
Then you just add that class
This could be done without changing the template.
Here’s an example in Coffeescript (not tested or anything)