Page MenuHomePhabricator

User needs to request access to IP information [L]
Closed, ResolvedPublic

Assigned To
Authored By
Niharika
Sep 30 2020, 5:25 AM
Referenced Files
F34738268: Screen Shot 2021-11-08 at 2.42.40 PM.png
Nov 8 2021, 7:43 PM
F34738269: Screen Shot 2021-11-08 at 2.40.36 PM.png
Nov 8 2021, 7:43 PM
F34693760: image.png
Oct 18 2021, 10:09 AM
F34693762: image.png
Oct 18 2021, 10:09 AM
F34646472: image.png
Sep 17 2021, 10:37 PM
F34619771: image.png
Aug 25 2021, 3:59 PM
Tokens
"Stroopwafel" token, awarded by Prtksxna.

Description

Goal

Per Legal, to grant IP Information to a user we need to have them explicitly request it for anti-vandalism purposes. This can be done via a simple check-box/accept button in the interface where they acknowledge they need IP information for anti-vandalism work.
Once the user has acquired access to the IP information, they will continue to have access for all future cases unless either:

  1. they give up their own access in preferences
  2. there is a need for re-permissioning due to Legal reasons

The purpose for this task is to implement a way for the user to be able to acknowledge they need IP information access for anti-vandalism work.
Once the user has acknowledged that, we will store their username as having IP information access in the database (T263756). We will allow the user to revoke the permission in their preferences if they need to do so (T264151).

Spec
1. From Special:Preferences2. From the IP Information accordion
image.png (444×1 px, 45 KB)
image.png (696×1 px, 66 KB)
  • There are two conditions that need to be met before the IP Information accordion displays information for the user:
    • User needs to enable the tool
    • User needs to accept to the terms of the tool
  • These are represented by two checkboxes in Special:Preferences, under the "User Profile tab" (see mock 1)
    • 1. Show the IP Information tool on Special:Contributions page for IP addresses.
    • 2. I agree to use this information for my patrolling and anti-vandalism work.
  • The user cannot agree to the terms without enabling the tool. The second checkbox is disabled until the first checkbox is checked.
  • If only the first checkbox is checked and the second one is unchecked, the user sees the agreement in the accordion on Special:Contribs (see mock 2). Once the user agrees to the terms, the preference is updated and the user can see the IP Information.
  • If the feature is not enabled (neither preference is checked), the accordion does not appear on Special:Contribs.
  • The IP Info popup does not appear anywhere unless both preferences are checked (tool is enabled and term have been agreed to).
Things to note (not part of this task):
  • T&S/Legal reserve the right to revoke a user’s access permissions in case of abuse
  • If a user’s permission is revoked by us, they should not be able to activate it again
  • Legal would like us to capture who had access to IP Info at any given time in case an incident occurs
  • There is a possibility that users might need to regain access periodically (TBD)
  • There is a possibility that the wording on the agreement might change, based on Legal review.

Related Objects

Event Timeline

Niharika triaged this task as Medium priority.Sep 30 2020, 5:25 AM
Niharika created this task.
Niharika renamed this task from [Design] User needs to request access to IP information to User needs to request access to IP information.Sep 30 2020, 5:26 AM
ARamirez_WMF renamed this task from User needs to request access to IP information to User needs to request access to IP information [8H].Oct 7 2020, 4:41 PM
Niharika renamed this task from User needs to request access to IP information [8H] to User needs to request access to IP information .Oct 7 2020, 4:55 PM

This task is on hold until late Q3/early Q4.

Niharika moved this task from Backlog to Up Next on the IP Info board.
ARamirez_WMF renamed this task from User needs to request access to IP information to User needs to request access to IP information [L].Sep 22 2021, 5:06 PM

@STran if you could update the task description to indicate what's covered in this task and what's covered in T291582: Implement condition agreements in Special:Preferences [M], that would help QA.

During the last AHT: Estimation & Planning meeting, I gave an overview of how to change a user's preferences in JS and in PHP. Here are links to relevant documentation as well as some snippets:

Documentation

It's also worth noting here that user preferences are stored in the user_properties table and we interact with that table programmatically via classes/methods that refer to them as options.

Snippets

JS
// Read
const fooOption = mw.user.options.get( 'foo' );

// Write
//
// Notes:
// 
// - Make sure that your ResourceLoader module depends on the `mediawiki.api` module.
// - See https://gerrit.wikimedia.org/g/mediawiki/core/+/33cd0740f76e55777081f994c936439bc541f6d6/resources/src/mediawiki.api/options.js
//   for the definitions of mw.Api.prototype.saveOption() and .saveOptions().
const api = new mw.Api();

api.saveOption( 'foo', 'bar' );
api.saveOptions( {
  foo: 'bar',
  baz: 'qux'
)
PHP
<?php

$userOptionsManager = MediaWikiServices::getInstance( 'UserOptionsLookup' );

// Read
$userOptionsManager->getOption( $user, 'foo' );

// Write
//
// Notes:
// - UserOptionsManager::saveOptions() MUST be called for non-default properties to be persisted to the `user_properties` table.
$userOptionsManager->setOption( $user, 'foo' );
$userOptionsManager->saveOptions( $user );

Change 729983 had a related patch set uploaded (by STran; author: STran):

[mediawiki/extensions/IPInfo@master] [WIP] Add use agreement form on infobox

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

Change 730017 had a related patch set uploaded (by STran; author: STran):

[mediawiki/extensions/IPInfo@master] Save user preference for infobox state

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

@Prtksxna Is there a standard spacing? Without styling, this is what I've got for the form so far:

image.png (186×778 px, 21 KB)

And I stubbed something out if it helps:

image.png (224×773 px, 22 KB)

@STran as far as I know OOUI comes with the required standard spacing, like the one we see in Special:Preferences. I might be wrong, but I think you get it for free when you use FormLayout or FieldLayout or something.

Ah only if you use it correctly though 😂 Thank you for confirming I was holding it wrong. 🙇

Change 729983 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Add use agreement form on infobox

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

Verified the requirement as listed in the acceptance criteria in the task description.
Test was done on supported desktop browsers (Firefox, Chrome, Opera, Safari, IE and Edge)

Note:

  1. We may need to force cleared cache when the IP permission is removed. When page is not refreshed a collapsed IP info box is still available to user.
  2. Is there a task to test, the super user, that can revoke IP privileges? Per this statment:

T&S/Legal reserve the right to revoke a user’s access permissions in case of abuse

Screen shots:

Screen Shot 2021-11-08 at 2.42.40 PM.png (1×2 px, 299 KB)

Screen Shot 2021-11-08 at 2.40.36 PM.png (1×2 px, 500 KB)

T&S/Legal reserve the right to revoke a user’s access permissions in case of abuse

I think that's covered by T291854: Create revoke user access maintenance script.