Add WSOAuth patch

wiki
Pyjacpp 2026-05-15 22:49:24 +02:00
parent 98259437f0
commit 18c59cdc85
No known key found for this signature in database
GPG Key ID: ED479A5A26930939
2 changed files with 49 additions and 9 deletions

View File

@ -0,0 +1,38 @@
diff --git a/src/WSOAuth.php b/src/WSOAuth.php
index 3a94c87..e077b9e 100644
--- a/src/WSOAuth.php
+++ b/src/WSOAuth.php
@@ -308,11 +308,12 @@ class WSOAuth extends PluggableAuth {
// Set $realname and $email to the values returned from the authentication provider, if they are available
$realname = $remoteUserInfo['realname'] ?? null;
$email = $remoteUserInfo['email'] ?? null;
+ $username = ucfirst( $remoteUserInfo['name'] );
- $remoteUsername = ucfirst( $remoteUserInfo['name'] );
- $localUserId = $this->getLocalAccountID( $remoteUsername );
+ $remoteUserId = $remoteUserInfo['remoteUserId'] ?? $username;
+ $localUserId = $this->getLocalAccountID( $remoteUserId );
- $this->session->set( self::WSOAUTH_REMOTE_USERNAME_SESSION_KEY, $remoteUsername );
+ $this->session->set( self::WSOAUTH_REMOTE_USERNAME_SESSION_KEY, $remoteUserId );
$this->session->save();
if ( $localUserId !== 0 ) {
@@ -326,7 +327,7 @@ class WSOAuth extends PluggableAuth {
$currentUser = RequestContext::getMain()->getUser();
$currentUserId = $currentUser->getId();
- $this->createMapping( $currentUserId, $remoteUsername );
+ $this->createMapping( $currentUserId, $remoteUserId );
// Log the account in like normal
$username = $currentUser->getName();
@@ -339,7 +340,7 @@ class WSOAuth extends PluggableAuth {
throw new ContinuationException( wfMessage( "wsoauth-remote-only-accounts-disabled" )->parse() );
}
- $desiredLocalUsername = $this->useRealNameAsUsername && $realname !== null ? $realname : $remoteUsername;
+ $desiredLocalUsername = $this->useRealNameAsUsername && $realname !== null ? $realname : $username;
$userId = User::newFromName( $desiredLocalUsername )->idForName();
if ( $userId > 0 && $this->migrateUsersByUsername ) {

View File

@ -292,15 +292,17 @@ in
# Pas de meilleure solution à ma connaissance pour suivre les releases. # Pas de meilleure solution à ma connaissance pour suivre les releases.
sha256 = "sha256-oi5rliHb4KnLbvQxO7MGuLp/FEucoGR/Z0NP1gmbgMc="; sha256 = "sha256-oi5rliHb4KnLbvQxO7MGuLp/FEucoGR/Z0NP1gmbgMc=";
}; };
WSOAuth = pkgs.fetctFromGitlab { WSOAuth = pkgs.applyPatches {
domain = "gitlab.crans.org"; src = pkgs.fetchFromGitHub {
name = "WSOAuth"; name = "WSOAuth";
owner = "pyjacpp"; owner = "wikimedia";
repo = "wsoauth"; repo = "mediawiki-extensions-WSOAuth";
rev = "master"; rev = "REL" + major + "_" + minor;
# Le SHA doit être changé à chaque nouveau commit de traduction. # Le SHA doit être changé à chaque nouveau commit de traduction.
# Pas de meilleure solution à ma connaissance pour suivre les releases. # Pas de meilleure solution à ma connaissance pour suivre les releases.
sha256 = "sha256-8jrRuHcJZc+YNnfyYkNLwF4PEIiHfd27YnTVAZcxgoc="; sha256 = "sha256-G2C/KuSgfWWftpHHhOABwFcOEb1zB8qmHi9KgrC6Jrc=";
};
patches = [ "${./WSOAuth.patch}" ];
}; };
WSONoteKfetAuth = "${./WSONoteKfetAuth}"; WSONoteKfetAuth = "${./WSONoteKfetAuth}";
}; };