{"comment":{"commit_id":"77dc8051dd87316277ec856c8a7a8de50513aa05","position":3,"created_at":"2011-12-10T14:40:02Z","updated_at":"2011-12-10T14:40:02Z","user":{"gravatar_id":"59211a1b7a548ffda538430bb5ca5e68","id":593977,"url":"https://api.github.com/users/beghelli","avatar_url":"https://secure.gravatar.com/avatar/59211a1b7a548ffda538430bb5ca5e68?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"beghelli"},"body":"I did this following the XACML concepts: they use one more level to define policies, that is the rule. Rules can be reused by policies, and that's what I thought I needed in this case, because we use this rule in two places now: the SeriesAssignmentPolicy and the UserAccessibleWorkflowStagePolicy. \n\nSo, I just wanted to keep this encapsulated somewhere, to hide the implementation details and, especially, to make easier to find where this logic is being used. Because we are dealing with security, I thought it was a good idea if we have explicit places that define our policies. If we want to change it later, it will be just in one place. This is the case that came to my mind: for some reason, we need to insert another piece of code to check if the editor is assigned to the current series. Then, if we don't have this class, the developer will change the SeriesAssignmentPolicy and then will think that's done. But the UserAccessibleWorkflowStagePolicy will still be using the previous series assignment code. Without this class it's harder to make a change without breaking one of those two policies, I think. \n\nConceptually I was very convinced that this was necessary, but I must confess that when I created this class I saw that the code there was too little and it makes me think twice. But I thought the tradeoff was worthwhile. If you think that's not, I can refactor this quickly, of course. :)","id":784047,"path":"classes/security/authorization/internal/SeriesAssignmentRule.inc.php","line":3,"html_url":"https://github.com/beghelli/omp/commit/77dc8051dd#commitcomment-784047","url":"https://api.github.com/repos/beghelli/omp/comments/784047"}}