o1.4 -- what is adjustmentLimiter ?

Topics: Administration, Core, Customizing Orchard, General, Writing modules
Jul 5, 2012 at 7:21 PM
Edited Jul 6, 2012 at 5:54 AM

In RolesBasedAuthorizationService.cs, I see this piece of funky code:

for ( var adjustmentLimiter = 0; adjustmentLimiter != 3; ++adjustmentLimiter )
  1. What is adjustmentLimiter?
  2. Why does it loop three times?
  3. What is supposed to happen at the first, second, third iteration?

Can anybody shed light on this?

Jul 6, 2012 at 9:25 PM
Edited Jul 6, 2012 at 9:27 PM

I remember seeing this when I was looking through the code, and I believe Sebastien wrote it.

I don't have the rest of the code in front of me right now but I believe it's a limit on the number of iterations that authorization can be adjusted by various handlers, because it re-runs through the handlers when one of them makes an adjustment. There would then be a possibility that one authorization handler would make an adjustment, which would cause another handler to make another adjustment in turn, causing an infinite loop.

It seems kind of silly though, because you could end up with authorization being based on an arbitrary and random result that is not predictable.

I could be wrong, though.