lundi 16 mai 2016

Setting Up Permissions Logic For User-Actions

This question is more about building up the logic than the code (building in React / Redux if you want to know) itself.

I am working on an app in which user can perform various actions onClick, depending on which series of options were selected previously.

As an example:

|--- TAB1 ---|--- CTRL1 ---|--- Onclick => color: red
             |             |--- Onclick => color : blue
             |--- CTRL2 ---|--- Onclick => color : green
             |             |--- Onclick => color : red
             |             |--- Onclick => color : black

|--- TAB2 ---|--- CTRL1 ---|--- Onclick => color : purple
             |             |--- Onclick => color : red
             |             |--- Onclick => color : maroon
             |             |--- Onclick => color : red
...

It goes on for pretty much the whole of app.

I wonder whether there are any good design patterns for these kinds of scenarios? I hope not to do a whole lot of if / select statements.

Aucun commentaire:

Enregistrer un commentaire