jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/316914 )
Change subject: Relax requirement of the user having an account on the central
wiki
......................................................................
Relax requirement of the user having an account on the central wiki
If the user has a local account and that is attached to the central
one, that suffices to verify that they are the rightful owner of the
central ID. There is no need for the user to have an account on the
central OAuth wiki, and a new user who does not have such an account
should not be prevented from authorizing providers on another wiki.
Bug: T148696
Change-Id: I671d873797589e715f31f7b26406ee63a03d2015
---
M backend/MWOAuthUtils.php
1 file changed, 7 insertions(+), 11 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/backend/MWOAuthUtils.php b/backend/MWOAuthUtils.php
index ee4d8e2..8a5e86d 100644
--- a/backend/MWOAuthUtils.php
+++ b/backend/MWOAuthUtils.php
@@ -210,7 +210,7 @@
* @return string|bool User name, false if not found, empty string if
name is hidden
*/
public static function getCentralUserNameFromId( $userId, $audience =
false ) {
- global $wgMWOAuthCentralWiki, $wgMWOAuthSharedUserIDs,
$wgMWOAuthSharedUserSource;
+ global $wgMWOAuthSharedUserIDs, $wgMWOAuthSharedUserSource;
if ( $wgMWOAuthSharedUserIDs ) { // global ID required via hook
$lookup = \CentralIdLookup::factory(
$wgMWOAuthSharedUserSource );
@@ -239,14 +239,12 @@
* @return \User|bool User or false if not found
*/
public static function getLocalUserFromCentralId( $userId ) {
- global $wgMWOAuthCentralWiki, $wgMWOAuthSharedUserIDs,
$wgMWOAuthSharedUserSource;
+ global $wgMWOAuthSharedUserIDs, $wgMWOAuthSharedUserSource;
if ( $wgMWOAuthSharedUserIDs ) { // global ID required via hook
$lookup = \CentralIdLookup::factory(
$wgMWOAuthSharedUserSource );
$user = $lookup->localUserFromCentralId( $userId );
- if ( $user === null ||
- !$lookup->isAttached( $user ) ||
!$lookup->isAttached( $user, $wgMWOAuthCentralWiki )
- ) {
+ if ( $user === null || !$lookup->isAttached( $user ) ) {
$user = false;
}
} else {
@@ -264,14 +262,14 @@
* @return integer|bool ID or false if not found
*/
public static function getCentralIdFromLocalUser( \User $user ) {
- global $wgMWOAuthCentralWiki, $wgMWOAuthSharedUserIDs,
$wgMWOAuthSharedUserSource;
+ global $wgMWOAuthSharedUserIDs, $wgMWOAuthSharedUserSource;
if ( $wgMWOAuthSharedUserIDs ) { // global ID required via hook
if ( isset( $user->oAuthUserData['centralId'] ) ) {
$id = $user->oAuthUserData['centralId'];
} else {
$lookup = \CentralIdLookup::factory(
$wgMWOAuthSharedUserSource );
- if ( !$lookup->isAttached( $user ) ||
!$lookup->isAttached( $user, $wgMWOAuthCentralWiki ) ) {
+ if ( !$lookup->isAttached( $user ) ) {
$id = false;
} else {
$id = $lookup->centralIdFromLocalUser(
$user );
@@ -290,15 +288,13 @@
}
/**
- * Given a username, get the user ID for that user on the central wiki.
This
- * function MUST NOT be used to determine if a user is attached on the
central
- * wiki. It's only intended to resolve the central id of a username.
+ * Given a username, get the user ID for that user on the central wiki.
* @param string $username
* @throws \MWException
* @return integer|bool ID or false if not found
*/
public static function getCentralIdFromUserName( $username ) {
- global $wgMWOAuthCentralWiki, $wgMWOAuthSharedUserIDs,
$wgMWOAuthSharedUserSource;
+ global $wgMWOAuthSharedUserIDs, $wgMWOAuthSharedUserSource;
if ( $wgMWOAuthSharedUserIDs ) { // global ID required via hook
$lookup = \CentralIdLookup::factory(
$wgMWOAuthSharedUserSource );
--
To view, visit https://gerrit.wikimedia.org/r/316914
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I671d873797589e715f31f7b26406ee63a03d2015
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Dpatrick <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits