Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AP1447] Change conditions for enabling CreateTicketIcon on results detailspage #3154

Merged
merged 3 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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