open-consul/ui/packages/consul-ui/app/components
John Cowen 599e8a05d3
ui: Ensure we check intention service prefix permissions for per service (#11409)
Port of: Ensure we check intention service prefix permissions for per service (#11270)

Previously, when showing some action buttons for 'per service intentions' we used a global 'can I do something with any intention' permission to decide whether to show a certain button or not. If a user has a token that does not have 'global' intention permissions, but does have intention permissions on one or more specific services (for example via service / service_prefix), this meant that we did not show them certain buttons required to create/edit the intentions for this specific service.

This PR adds that extra permissions check so we now check the intentions permissions per service instead of using the 'global' "can I edit intentions" question/request.

**Notes:**

- If a HTML button is `disabled` this means tippy.js doesn't adopt the
popover properly and subsequently hide it from the user, so aswell as
just disabling the button so you can't active the popover, we also don't
even put the popover on the page
- If `ability.item` or `ability.item.Resources` are empty then assume no access

**We don't try to disable service > right hand side intention actions here**

Whether you can create intentions for a service depends on the
_destination_ of the intention you would like to create. For the
topology view going from the LHS to the center, this is straightforwards
as we only need to know the permissions for the central service, as when
you are going from the LHS to the center, the center is the
_destination_.

When going from the center to the RHS the _destination[s]_ are on the
RHS. This means we need to know the permissions for potentially 1000s of
services all in one go in order to know when to show a button or not.

We can't realistically discover the permissions for service > RHS
services as we'd have either make a HTTP request per right hand service,
or potentially make an incredibly large POST request for all the
potentially 1000s of services on the right hand side (more preferable to
1000s of HTTP requests).

Therefore for the moment at least we keep the old functionality (thin client)
for the middle to RHS here. If you do go to click on the button and you
don't have permissions to update the intention you will still not be
able to update it, only you won't know this until you click the button
(at which point you'll get a UI visible 403 error)

Note: We reversed the conditional here between 1.10 and 1.11

So this make 100% sense that the port is different here to 1.11
2021-11-04 12:10:28 +00:00
..
action ui: Improve dev-time SSO/OIDC visibility (#11248) 2021-10-11 16:03:59 +01:00
anchors ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
anonymous ui: Notice component (#9011) 2020-10-23 09:26:32 +01:00
app ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
app-error ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
app-view ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
aria-menu ui: Adds CRD popover 'informed action' for intentions managed by CRDs (#10100) 2021-05-04 17:21:54 +01:00
auth-dialog ui: Make it hard to not URLEncode DataSource srcs/URIs (#11117) 2021-09-30 15:54:46 +01:00
auth-form ui: Remove remaining partition FIXME comments (#11312) 2021-10-19 12:31:30 +01:00
auth-modal ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
auth-profile ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
badge ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
brand-loader ui: Loader amends/improvements (#10181) 2021-05-07 12:23:29 +01:00
breadcrumbs ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
buttons ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
card ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
certificate ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
checkbox-group ui: Colocate old base components into our app/component folder (#10275) 2021-05-26 15:08:57 +01:00
child-selector ui: Add partition parameter when clearing child-selector forms in ACLs (#11106) 2021-09-22 18:36:09 +01:00
code-editor ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
collapsible-notices ui: Topology - Fix up Default Allow and Permissive Intentions notices (#11216) 2021-10-12 09:27:06 -04:00
composite-row ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
confirmation-alert ui: Search/filtering 'Filtered by:' search status (#9442) 2021-01-25 18:13:54 +00:00
confirmation-dialog ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
consul ui: Ensure we check intention service prefix permissions for per service (#11409) 2021-11-04 12:10:28 +00:00
copy-button ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
csv-list ui: %horizontal-kv-list CSS component (and related) (#10285) 2021-06-21 11:40:14 +01:00
data-collection ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
data-form ui: Adds initial CRUD for partitions (#11188) 2021-10-08 16:29:30 +01:00
data-loader ui: Fix up blocking reconciliation for multiple models (#11237) 2021-10-07 12:38:04 +01:00
data-sink ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
data-source ui: Address some Admin Partition FIXMEs (#11057) 2021-10-01 11:07:58 +01:00
data-writer ui: Adds initial CRUD for partitions (#11188) 2021-10-08 16:29:30 +01:00
debug/navigation ui: Remove storybook, add docfy (#9831) 2021-03-08 12:22:01 +00:00
definition-table ui: Fixup definition-table + copy-button margin (#10512) 2021-07-06 16:57:20 +01:00
delete-confirmation ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
display-toggle ui: Colocate old base components into our app/component folder (#10275) 2021-05-26 15:08:57 +01:00
dom-recycling-table ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
empty-state ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
error-state ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
event-source ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
expanded-single-select ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
filter-bar ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
flash-message ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
form-component ui: Move linting to the `node:test` script (#9385) 2020-12-14 15:28:35 +00:00
form-elements ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
form-group ui: [BUGFIX] Replace all replaceAll with split.join for older browsers without replaceAll (#9715) 2021-02-11 09:49:39 +00:00
freetext-filter ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
hashicorp-consul ui: Ensure dc selector correctly shows the currently selected dc (#11380) 2021-10-26 19:26:04 +01:00
horizontal-kv-list ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
icon-definition ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
informed-action ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
inline-alert ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
inline-code ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
jwt-source ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
list-collection ui: Adds initial CRUD for partitions (#11188) 2021-10-08 16:29:30 +01:00
list-row ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
main-header-horizontal ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
main-nav-horizontal ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
main-nav-vertical ui: Ensure dc selector correctly shows the currently selected dc (#11380) 2021-10-26 19:26:04 +01:00
menu-panel ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
modal-dialog ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
modal-layer ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
more-popover-menu ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
notice ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
notification ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
oidc-select ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
outlet ui: Ensure dc selector correctly shows the currently selected dc (#11380) 2021-10-26 19:26:04 +01:00
overlay ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
pill ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
policy-form ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
policy-selector ui: Make it hard to not URLEncode DataSource srcs/URIs (#11117) 2021-09-30 15:54:46 +01:00
popover-menu ui: Colocate old base components into our app/component folder (#10275) 2021-05-26 15:08:57 +01:00
popover-select ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
power-select ui: Initial Intention Permission Integration and acceptance testing (#9003) 2020-10-23 17:26:06 +01:00
progress ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
radio-card ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
radio-group ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
ref ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
role-form ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
role-selector ui: Move the Role remove dialog to use InformedAction (#11298) 2021-10-14 13:54:27 +01:00
route ui: Fix up blocking reconciliation for multiple models (#11237) 2021-10-07 12:38:04 +01:00
search-bar ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
secret-button ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
skip-links ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
sliding-toggle ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
state ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
state-chart ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
tab-nav ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
table ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
tabular-collection ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
tabular-details ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
tabular-dl ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
tag-list ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
text-input ui: Adds initial CRUD for partitions (#11188) 2021-10-08 16:29:30 +01:00
toggle-button ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
token-list ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
token-source ui: Address some Admin Partition FIXMEs (#11057) 2021-10-01 11:07:58 +01:00
tooltip ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
tooltip-panel ui: Replaces almost all remaining instances of SASS variables with CSS (#11200) 2021-10-07 19:21:11 +01:00
topology-metrics ui: Ensure we check intention service prefix permissions for per service (#11409) 2021-11-04 12:10:28 +00:00