Last modified: 2014-02-24 15:50:50 UTC
https://gerrit.wikimedia.org/r/#/c/114974/2/api/ApiGroupReview.php,unified seems to have a bad code smell to me. Do we really require every API module to define "isAllowed" and "isBlocked"? That seems like a flawed architectural design to me, if so. When being extended, it seems to me that the base MediaWiki API should be able to handle these checks implicitly, to avoid situations like this.
Or, alternately, perhaps we need to fail faster when these checks are missing.
A nitpick: We don't require API modules to "define" any such methods. But if something wants to check for user rights or for blocked status then it needs to *call* (not "define") the methods to check for user rights or blocked status.
This seems to me as little different from now the rest of MediaWiki handles permissions checks, except for Special pages. And even many special pages need to go beyond the simple checks provided for in the base class. So no, I don't think that we need to try to cram flags for block and permissions checking into the already-overgrown API base classes.
Regarding that linked change in particular, it sounds like they have code duplication with their web UI code and their API code. Instead there should be some back-end method that does the actual work and returns status to the UI layer and both the web UI and the API should be calling that.