Skip to content

Commit

Permalink
Fix getApplicationUserRoles (NOJIRA)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Apr 14, 2025
1 parent 4f1f7f3 commit 624446f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions app/src/Controller/Component/RegistryAuthComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,19 @@ public function getApplicationUserRoles(?int $coId): array {
$appUserRoles['person_identifier'] = $this->getAuthenticatedUser();
if ($coId) {
// Person ID
$appUserRoles['person_id'] = $this->getPersonID($coId) ?? null;
// Person Full Name
if (!empty($appUserRoles['person_id'])) {
$Names = TableRegistry::getTableLocator()->get('Names');
$appUserRoles['person_fullname'] = $Names->primaryName((int)$appUserRoles['person_id'])->full_name;
$appUserRoles['person_id'] = null;

try {
$appUserRoles['person_id'] = $this->getPersonID($coId);

// Person Full Name
if (!empty($appUserRoles['person_id'])) {
$Names = TableRegistry::getTableLocator()->get('Names');
$appUserRoles['person_fullname'] = $Names->primaryName((int)$appUserRoles['person_id'])->full_name;
}
}
catch(\Exception $e) {
// If there is no authenticated user getPersonID will throw an exception
}
}

Expand Down

0 comments on commit 624446f

Please sign in to comment.