Background
Weekly, we will ask some users to ask for help, why you canโt do X in form Y. Due to complex business rules, we often have to pay attention to the code itself to find out why this particular action is not available at that time. Are there any proven strategies to solve this problem?
How to collect all the information from the GUI, business rules and / or security, which causes the button to turn off?
Example
The user cannot delete a dimension from the dimension overview form because
GUI
- there are no dimensions in the form.
- Several dimensions are selected in the form.
Business rules
- The selected measurement was used in the calculation.
- The selected dimension is related to (what we call) the product.
Security
- The current user is not in the group of analysts responsible for this particular dimension.
- The current user is not an analyst.
Edit
Regarding valid comments that we have already done the calculation in order to decide whether the control should be disabled.
We use a home brew ACL for security processing. These are the steps to decide whether to disable a control.
- The global ACL is retrieved (currently from the database). If a
Write ACE present in the ACL for the dimension property, this means that the current user has the right to change the dimension. - The dimension business object receives a copy of this global ACL. A business object puts its business rules on top of the received ACL. If the business rules indicate that the measurement should not be written, it adds the
Deny Write ACE to the ACL.
Note that a business object can make protection more restrictive. If global security dictates, it is impossible to do, it is impossible. - Communication with the business object ACL and the GUI is done through what we call our GuiMap object. This object retrieves a copy of the ACL from the business object and allows the developer to add function pointers that return Boolean to add
Gui rules on top of the ACL of the business objects.
Now, in order to determine whether a button should be turned on, GuiMap evaluates each function passed to it in combination with the protection determined by the ACL of the business object, and in extreme conditions with user safety.
- If the user does not have rights, the result is always disabled.
- else, if business rules say it should be disabled, it is disabled.
- else, if any Gui rule says that it should be disabled, it is disabled.
So, in fact, each layer is built on top of the previous one to determine the final result. It doesn't seem like there will be one calculation to determine if a button or something else needs to be activated.
The beauty, if you like, is this: since the ACL sends the copies, the copies attach to the master and get notified when their main ACL is updated. It allows us
- Let each control refresh if users log out on any screen.
- Let each control be updated when a business object that requires it changes.
This works well for us, except that itโs hard to understand why something is disabled.
user-interface design-patterns
Lieven keersmaekers
source share