mirror of https://gitlab.crans.org/nounous/nixos
Add WSOAuth patch
parent
98259437f0
commit
18c59cdc85
|
|
@ -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 ) {
|
||||
|
|
@ -292,15 +292,17 @@ in
|
|||
# Pas de meilleure solution à ma connaissance pour suivre les releases.
|
||||
sha256 = "sha256-oi5rliHb4KnLbvQxO7MGuLp/FEucoGR/Z0NP1gmbgMc=";
|
||||
};
|
||||
WSOAuth = pkgs.fetctFromGitlab {
|
||||
domain = "gitlab.crans.org";
|
||||
WSOAuth = pkgs.applyPatches {
|
||||
src = pkgs.fetchFromGitHub {
|
||||
name = "WSOAuth";
|
||||
owner = "pyjacpp";
|
||||
repo = "wsoauth";
|
||||
rev = "master";
|
||||
owner = "wikimedia";
|
||||
repo = "mediawiki-extensions-WSOAuth";
|
||||
rev = "REL" + major + "_" + minor;
|
||||
# Le SHA doit être changé à chaque nouveau commit de traduction.
|
||||
# Pas de meilleure solution à ma connaissance pour suivre les releases.
|
||||
sha256 = "sha256-8jrRuHcJZc+YNnfyYkNLwF4PEIiHfd27YnTVAZcxgoc=";
|
||||
sha256 = "sha256-G2C/KuSgfWWftpHHhOABwFcOEb1zB8qmHi9KgrC6Jrc=";
|
||||
};
|
||||
patches = [ "${./WSOAuth.patch}" ];
|
||||
};
|
||||
WSONoteKfetAuth = "${./WSONoteKfetAuth}";
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue