Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion classes/XDUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2443,7 +2443,16 @@ public static function validateRID($rid)
public function postLogin() {
if (!$this->isSticky()) {
$this->updatePerson();
$this->synchronizeOrganization();
$orgHasChanged = $this->synchronizeOrganization();
// If the user hasn't changed organizations, check if they should
// be given the Campus Champion ACL (CampusChampionAclUpdater is
// defined in the xdmod-xsede module).
if (
!$orgHasChanged
&& class_exists('\User\CampusChampionAclUpdater')
) {
\User\CampusChampionAclUpdater::update($this);
}
}
$this->currentToken = XDSessionManager::recordLogin($this);
}
Expand All @@ -2457,10 +2466,14 @@ public function postLogin() {
* to the admin / user notifying them that additional steps will need to be taken before their
* former level of access is restored.
*
* @return bool whether the user's organization had been updated.
* @throws Exception
*/
public function synchronizeOrganization()
{
// Temporarily assume the user's organization has not been updated.
$orgHasChanged = false;

// This is pulled from the moddb.Users.organization_id column for this user record.
$actualOrganization = $this->getOrganizationID();

Expand All @@ -2476,6 +2489,7 @@ public function synchronizeOrganization()

// If these don't match then the user's organization has been updated. Steps need to be taken.
if ($actualOrganization !== $expectedOrganization) {
$orgHasChanged = true;
$originalAcls = $this->getAcls(true);

// if the user is currently assigned an acl that interacts with XDMoD's centers ( i.e.
Expand Down Expand Up @@ -2547,6 +2561,8 @@ public function synchronizeOrganization()
$this->setOrganizationId($expectedOrganization);
$this->saveUser();
}

return $orgHasChanged;
}

/**
Expand Down