Page MenuHomePhabricator

ApiQueryAbuseLog: user_rights should be provided as an array
Closed, ResolvedPublic

Description

Currently, using ApiQueryAbuseLog and retrieving details returns the user_rights as a string joined with \n, eg:
"user_rights": "createaccount\nread\nedit\ncreatetalk\nwriteapi\nviewmywatchlist\neditmywatchlist\nviewmyprivateinfo\neditmyprivateinfo\neditmyoptions\nabusefilter-log-detail\ncentralauth-merge\nabusefilter-view\nabusefilter-log\nvipsscaler-test\ncollectionsaveasuserpage\nreupload-own\nmove-rootuserpages\nmove-categorypages\ncreatepage\nminoredit\neditmyusercss\neditmyuserjson\neditmyuserjs\npurge\nsendemail\napplychangetags\nspamblacklistlog\nmwoauthmanagemygrants\n",
I propose that, instead, this be returned as an array. Thoughts?

Event Timeline

DannyS712 created this task.Dec 6 2019, 2:12 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 moved this task from Unsorted to Abuse Filter on the User-DannyS712 board.

In AbuseFilter, it is indeed an array. E.g., I tried length(user_rights) === 42 in Special:AbuseFilter/test and edits of users with 42 rights come up.

I think this is simply the printing issue. As I understand, https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/421966/ is going to fix it.

In AbuseFilter, it is indeed an array. E.g., I tried length(user_rights) === 42 in Special:AbuseFilter/test and edits of users with 42 rights come up.

I think this is simply the printing issue. As I understand, https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/421966/ is going to fix it.

I don't think so - https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/421966/37/includes/api/ApiQueryAbuseLog.php makes it so that it'll always be shown as a string, rather than the native (array)

In AbuseFilter, it is indeed an array. E.g., I tried length(user_rights) === 42 in Special:AbuseFilter/test and edits of users with 42 rights come up.

I think this is simply the printing issue. As I understand, https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/421966/ is going to fix it.

That's very right, aside from the last part:

I don't think so - https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/421966/37/includes/api/ApiQueryAbuseLog.php makes it so that it'll always be shown as a string, rather than the native (array)

This is also correct.

In the linked patch, I probably didn't change the API module out of caution. However, given that this is the same issue that the patch tries to fix, I'm going to include it as well.

Change 421966 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Improve var dumping in /details, /examine and /tools

https://gerrit.wikimedia.org/r/421966

DannyS712 reassigned this task from DannyS712 to Daimona.Dec 6 2019, 4:15 PM

Change 421966 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Improve var dumping in /details, /examine and /tools

https://gerrit.wikimedia.org/r/421966

Daimona closed this task as Resolved.Apr 30 2020, 5:43 PM