Page MenuHomePhabricator

Re-examine API module permissions (isAllowed, isBlocked) checks
Closed, DeclinedPublic

Description,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.

Version: 1.23.0
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:07 AM
bzimport added a project: MediaWiki-API.
bzimport set Reference to bz61841.
bzimport added a subscriber: Unknown Object (MLST).

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.

Krinkle added a subscriber: Krinkle.
Anomie moved this task from Unsorted to Non-Code on the MediaWiki-API board.Feb 19 2015, 6:41 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 18 2015, 12:52 AM
TTO added a subscriber: TTO.Dec 19 2015, 9:48 AM
Anomie closed this task as Declined.May 9 2017, 5:02 PM