Skip to content

Commit 86ea0f7

Browse files
committed
DIS-437 When authenticating the user, only authenticate with the Account Profile attached to the active library
1 parent cc1f1de commit 86ea0f7

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

code/web/release_notes/25.03.00.MD

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
### Other Updates
4343
- Remove unused AspenLiDASettings class. (DIS-393) (*MDN*)
4444
- Set translation metadata properly when creating a new collection spotlight. (DIS-427) (*MDN*)
45+
- When authenticating the user, only authenticate with the Account Profile attached to the active library. (DIS-437) (*MDN*)
4546

4647
// kirstien
4748

code/web/sys/UserAccount.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,21 @@ public static function validateAccount(?string $username, ?string $password, ?st
731731
}
732732

733733
foreach ($driversToTest as $driverName => $additionalInfo) {
734-
if ($accountSource == null || $accountSource == $additionalInfo['accountProfile']->name) {
734+
/** @var AccountProfile $accountProfile */
735+
$accountProfile = $additionalInfo['accountProfile'];
736+
$okToCheckAccountProfile = false;
737+
if ($accountSource == null) {
738+
if ($accountProfile->id == $library->accountProfileId) {
739+
$okToCheckAccountProfile = true;
740+
}elseif ($accountProfile->authenticationMethod == 'db' || $accountProfile->authenticationMethod == 'sso') {
741+
$okToCheckAccountProfile = true;
742+
}
743+
}else{
744+
$okToCheckAccountProfile = $accountSource == $accountProfile->name;
745+
}
746+
747+
if ($okToCheckAccountProfile) {
748+
$logger->log("authenticating $username with profile $accountProfile->name", Logger::LOG_DEBUG);
735749
try {
736750
$authN = AuthenticationFactory::initAuthentication($additionalInfo['authenticationMethod'], $additionalInfo);
737751
} catch (UnknownAuthenticationMethodException $e) {

0 commit comments

Comments
 (0)