Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #25 from Ioannis/Meaningful_redirect_when_no_valid…
…_identifier

Meaningful_redirect_when_no_valid_identifier
aaschenbrener committed Jun 28, 2024
2 parents 828336b + 2e86a35 commit 8028b7e
Showing 2 changed files with 33 additions and 4 deletions.
34 changes: 31 additions & 3 deletions 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,
3 changes: 2 additions & 1 deletion 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.',
];

0 comments on commit 8028b7e

Please sign in to comment.