dolittle-obsolete / DotNET.Fundamentals

Reusable, fundamental abstractions and building blocks
http://www.dolittle.io
MIT License
4 stars 8 forks source link

Securables are too eager. We should only do the "action", if the condition is met. #135

Closed smithmx closed 5 years ago

smithmx commented 5 years ago

See for example:

https://github.com/dolittle/Runtime/blob/d7aa7f7127eabdbf424424a92f1e13828899c5fe/Source/Commands.Security/CommandSecurityExtensions.cs

In the InNamespace and InstanceOf methods, we immediately call the Action that is supplied. We should only call the action when the condition and "CanAuthorize" is applied.

The means we don't do an expensive db call (for example) until we know that the rule applies to this securable.

smithmx commented 5 years ago

User error!