diff --git a/Controller/GrouperGroupsController.php b/Controller/GrouperGroupsController.php index f50c289..8683bc6 100644 --- a/Controller/GrouperGroupsController.php +++ b/Controller/GrouperGroupsController.php @@ -505,8 +505,18 @@ public function isAuthorized(): array|bool $cfg = $this->CoGrouperLiteWidget->getConfig(); // Find the identifier $copersonid = !empty($roles['copersonid']) ? $roles['copersonid'] : $pids['copersonid']; - $this->setUserId($this->GrouperGroup->getIdentifierFromPersonId($copersonid, - $cfg['CoGrouperLiteWidget']['identifier_type'])); + + $identifier = $this->GrouperGroup->getIdentifierFromPersonId($copersonid, + $cfg['CoGrouperLiteWidget']['identifier_type']); + if(empty($identifier)) { + // Redirect to the dashboard + $this->Flash->set( + _txt('er.grouperlite.ident.notfound', array($cfg['CoGrouperLiteWidget']['identifier_type'])), + array('key' => 'error') + ); + $this->performRedirect(); + } + $this->setUserId($identifier); // Find if the user belongs to Group $eligibleGroup = $cfg['CoGrouperLiteWidget']['act_as_grp_name']; @@ -633,6 +643,24 @@ public function parseCOID($data = null): int { return -1; } + /** + * Perform a redirect back to the controller's default view. + * - postcondition: Redirect generated + * + * @since COmanage Registry v4.4.0 + */ + + public function performRedirect() { + // Redirect back to the default index sort + + $this->redirect(array( + 'controller' => 'co_dashboards', + 'plugin' => null, + 'action' => 'dashboard', + 'co' => $this->cur_co['Co']['id'] + )); + } + /** * Remove a member from a group * @@ -675,7 +703,7 @@ public function removeSubscriber(): void * @param $statusTxt $contentType Status text * * @throws JsonException - * @since COmanage Registry v4.4.4 + * @since COmanage Registry v4.4.0 */ public function restResponse(int $status, diff --git a/Lib/lang.php b/Lib/lang.php index 8152ae0..ef10147 100644 --- a/Lib/lang.php +++ b/Lib/lang.php @@ -178,5 +178,6 @@ 'pl.grouperlite.members.noaccess' => 'You do not have access to view memberships.', 'pl.grouperlite.members.empty' => 'This group has no member OR you are not authorized to see the members of this group.', - 'er.grouperlite.glid' => 'Named parameter glid was not found', + 'er.grouperlite.glid' => 'Named parameter glid was not found', + 'er.grouperlite.ident.notfound' => '"%1$s" Identifier not found.', ]; \ No newline at end of file