Skip to content

Commit

Permalink
Merge pull request #3154 from greenbone/swaterkamp/createTicketPerms2104
Browse files Browse the repository at this point in the history
[AP1447] Change conditions for enabling CreateTicketIcon on results detailspage
  • Loading branch information
sarahd93 authored Sep 15, 2021
2 parents 8294096 + d292ef4 commit f8a13ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added

### Changed
- Changed conditions for enabling CreateTicketIcon on results detailspage [#3154](https://github.com/greenbone/gsa/pull/3154)

### Deprecated

Expand Down
1 change: 1 addition & 0 deletions gsa/public/locales/gsa-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@
"Permissions": "Berechtigungen",
"Permissions ({{count}})": "Berechtigungen ({{count}})",
"Permissions Filter": "Berechtigungen-Filter",
"Permissions to create a ticket are insufficient. You need the create_permission and get_users permissions.": "Die Berechtigungen ein Ticket zu erstellen sind unzureichend. Sie benötigen die create_permission- und get_users-Berechtigungen.",
"Physical": "Physisch",
"Platform": "Plattform",
"Please be aware that:": "Bitte beachten Sie, dass:",
Expand Down
12 changes: 11 additions & 1 deletion gsa/src/web/pages/results/detailspage.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ export const ToolBarIcons = ({
}) => {
const capabilities = useCapabilities();

const isMissingPermissions =
!capabilities.mayCreate('permission') || !capabilities.mayAccess('users');
const createTicketIconTitle = isMissingPermissions
? _(
'Permissions to create a ticket are insufficient. You need the ' +
'create_permission and get_users permissions.',
)
: _('Create new Ticket');

return (
<Divider margin="10px">
<IconDivider>
Expand Down Expand Up @@ -132,7 +141,8 @@ export const ToolBarIcons = ({
)}
{capabilities.mayCreate('ticket') && (
<NewTicketIcon
title={_('Create new Ticket')}
title={createTicketIconTitle}
disabled={isMissingPermissions}
value={entity}
onClick={onTicketCreateClick}
/>
Expand Down

0 comments on commit f8a13ef

Please sign in to comment.