TruffleMuffin / Decisions

A Claims based model for resolving bespoke authorization/security operations.
1 stars 0 forks source link

Service CheckMany should return the input contexts as dictionary keys #33

Open apjones6 opened 10 years ago

apjones6 commented 10 years ago

At the moment you need to know the internals of decision context or make a best guess to match the contexts you provided against the keys in the output dictionary. The keys should be the contexts so you can do object equality lookups (so don't return an identical copy of the context!).

Could include the 'key' string as a property of the context if you want to resolve this somewhat without requiring a major version bump I guess, but it's not really the best solution.

Logged as a bug instead of an enhancement, because I feel it makes usage of the CheckMany function risky, and could well be the cause of bugs from difficulty in safely using it.

TruffleMuffin commented 10 years ago

I think it can be handled without a Major version bump by simply making DecisionContext implicitly castable to a string. Map that string to be the DecisionContext.Id. That should prevent build errors on update.

apjones6 commented 10 years ago

Seems okay, but not sure if ID is a logical name for this property in it.

Ensure you have an implicit constructor for reversal, and set a constraint that a context can never include additional information not put into this string?

Ensure ToString is also set correctly? (can't be bothered to check this moment)