I just stumbled on the concept of feature markers and the popular open source Java version for this called Togglz , which quotes Martin Fowler's blog post:
The basic idea is to have a configuration file that defines a set of radio buttons for the various functions that you expect. The running application then uses these switches to decide whether or not to show the new feature.
But for me it really sounds like authorization : is the user allowed to view this content?
For example, should the user see the FizzBuzz menu or not?
In Togglz, I can do this check like this:
if(MyFeatures.ShowFizzBuzz.isActive()) {
In, say, Apache Shiro, I could do the same:
ShowFizzBuzzPermission showFizzBuzz = new ShowFizzBuzzPermission(); if(currentUser.isPermitted(showFizzBuzz) {
Again, tagging a function just looks like the exact same problem as role checking or validation.
I'm sure I'm wrong, but I donβt understand how to do this. So I ask: how does the flag function differ from authorization, role / permission checking, and what types of specific use cases illustrate this difference? In other words: When should I use authorization / role / permission checking and when should function flags be used?
java security authorization featuretoggle togglz
smeeb
source share