Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user update logic #1975

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions classes/Models/Services/Organizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static function getNameById($organizationId)
* $organizationName.
*
* @param string $organizationName the name of the organization to retrieve.
* @return int -1 if no record is found else the organization_id as an int.
* @return string '-1' if no record is found else the organization_id as a string.
* @throws \Exception if there is a problem retrieving a db connection.
* @throws \Exception if there is a problem executing the sql statement.
*/
Expand All @@ -57,7 +57,7 @@ public static function getIdByName($organizationName)
"SELECT o.id FROM modw.organization o WHERE o.name = :organization_name;",
array(':organization_name' => $organizationName)
);
return !empty($rows) ? $rows[0]['id'] : -1;
return !empty($rows) ? $rows[0]['id'] : '-1';
}

/**
Expand All @@ -82,7 +82,7 @@ public static function getAbbrevById($organizationId)
* Attempt to retrieve the organization_id for the specified person_id.
*
* @param int $personId
* @return int id of the organization or -1 if not found
* @return string id of the organization or '-1' if not found
* @throws \Exception
*/
public static function getOrganizationIdForPerson($personId)
Expand All @@ -95,6 +95,6 @@ public static function getOrganizationIdForPerson($personId)
)
);

return count($rows) > 0 ? $rows[0]['organization_id'] : -1;
return count($rows) > 0 ? $rows[0]['organization_id'] : '-1';
}
}
2 changes: 1 addition & 1 deletion classes/XDUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2469,7 +2469,7 @@ public function synchronizeOrganization()

// If we have ssoAttrs available and this user's person's organization is 'Unknown' ( -1 ).
// Then go ahead and lookup the organization value from sso.
if ($expectedOrganization == -1 && count($this->ssoAttrs) > 0) {
if ($expectedOrganization == -1 && isset($this->ssoAttrs['organization']) && count($this->ssoAttrs['organization']) > 0) {
$expectedOrganization = Organizations::getIdByName($this->ssoAttrs['organization'][0]);
}

Expand Down