Authorization Rule or Business Rule

Authorization Rule or Business Rule

Old forum URL: forums.lhotka.net/forums/t/7304.aspx


Russel posted on Monday, July 20, 2009

Hi

I have encountered a scenario where I need a property to be disabled - but only when a certain condition is met. The property accepts a enum value, so it can be one of 6 values. When this 'condition' is met, the property should be deactivated - meaning that you cannot change it.

I know that the Auth rules contains the CanWriteProperty - but this is more of a business validation issues than a authorization issue.

Should I just raise an exception whenever the property is changed? How would I go to work on this?

Marjon1 replied on Monday, July 20, 2009

The other thing to consider is overriding CanWriteProperty() method and then putting into that method for the specific property. You can then use the ReadWriteAuthorization control to enable/disable your controls and the standard write exceptions would be thrown if a developer did try to set it manually.

Copyright (c) Marimer LLC