Skip to content

Commit

Permalink
Make team members list operations access-aware (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
boobaa authored Aug 5, 2020
1 parent 94e52be commit 453354d
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions modules/apigee_edge_teams/src/Controller/TeamMembersList.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,22 @@ protected function buildOperations(string $member, TeamInterface $team): array {
*/
protected function getOperations(string $member, TeamInterface $team) {
$operations = [];
$operations['edit'] = [
'title' => $this->t('Edit'),
'url' => Url::fromRoute('entity.team.member.edit', ['team' => $team->id(), 'developer' => $member], ['query' => ['destination' => $team->toUrl('members')->toString()]]),
];
$operations['remove'] = [
'title' => $this->t('Remove'),
'url' => Url::fromRoute('entity.team.member.remove', ['team' => $team->id(), 'developer' => $member], ['query' => ['destination' => $team->toUrl('members')->toString()]]),
];

$url = Url::fromRoute('entity.team.member.edit', ['team' => $team->id(), 'developer' => $member], ['query' => ['destination' => $team->toUrl('members')->toString()]]);
if ($url->access()) {
$operations['edit'] = [
'title' => $this->t('Edit'),
'url' => $url,
];
}

$url = Url::fromRoute('entity.team.member.remove', ['team' => $team->id(), 'developer' => $member], ['query' => ['destination' => $team->toUrl('members')->toString()]]);
if ($url->access()) {
$operations['remove'] = [
'title' => $this->t('Remove'),
'url' => $url,
];
}

return $operations;
}
Expand Down

0 comments on commit 453354d

Please sign in to comment.