@@ -2443,11 +2443,16 @@ public static function validateRID($rid)
2443
2443
public function postLogin () {
2444
2444
if (!$ this ->isSticky ()) {
2445
2445
$ this ->updatePerson ();
2446
- // CampusChampionAclUpdater is defined in the xdmod-xsede module.
2447
- if (class_exists ('\User\CampusChampionAclUpdater ' )) {
2446
+ $ orgHasChanged = $ this ->synchronizeOrganization ();
2447
+ // If the user hasn't changed organizations, check if they should
2448
+ // be given the Campus Champion ACL (CampusChampionAclUpdater is
2449
+ // defined in the xdmod-xsede module).
2450
+ if (
2451
+ !$ orgHasChanged
2452
+ && class_exists ('\User\CampusChampionAclUpdater ' )
2453
+ ) {
2448
2454
\User \CampusChampionAclUpdater::update ($ this );
2449
2455
}
2450
- $ this ->synchronizeOrganization ();
2451
2456
}
2452
2457
$ this ->currentToken = XDSessionManager::recordLogin ($ this );
2453
2458
}
@@ -2461,10 +2466,14 @@ public function postLogin() {
2461
2466
* to the admin / user notifying them that additional steps will need to be taken before their
2462
2467
* former level of access is restored.
2463
2468
*
2469
+ * @return bool whether the user's organization had been updated.
2464
2470
* @throws Exception
2465
2471
*/
2466
2472
public function synchronizeOrganization ()
2467
2473
{
2474
+ // Temporarily assume the user's organization has not been updated.
2475
+ $ orgHasChanged = false ;
2476
+
2468
2477
// This is pulled from the moddb.Users.organization_id column for this user record.
2469
2478
$ actualOrganization = $ this ->getOrganizationID ();
2470
2479
@@ -2480,6 +2489,7 @@ public function synchronizeOrganization()
2480
2489
2481
2490
// If these don't match then the user's organization has been updated. Steps need to be taken.
2482
2491
if ($ actualOrganization !== $ expectedOrganization ) {
2492
+ $ orgHasChanged = true ;
2483
2493
$ originalAcls = $ this ->getAcls (true );
2484
2494
2485
2495
// if the user is currently assigned an acl that interacts with XDMoD's centers ( i.e.
@@ -2551,6 +2561,8 @@ public function synchronizeOrganization()
2551
2561
$ this ->setOrganizationId ($ expectedOrganization );
2552
2562
$ this ->saveUser ();
2553
2563
}
2564
+
2565
+ return $ orgHasChanged ;
2554
2566
}
2555
2567
2556
2568
/**
0 commit comments