Commit e1bbcc5
[Security Solution][Navigation] Distinguish between unavailable and unauthorized (elastic#220552)
## Summary
Implements different behaviour for unavailable vs unauthorised links.
### Challenge
In serverless, the application links implementation did not discriminate
between these 2 scenarios:
- **unavailable**: The link can not be accessed because it's not
available in the current payment plan (aka PLI scenario)
- **unauthorized**: The link can not be accessed because the user does
not have sufficient privileges (aka RBAC scenario)
This happened because, in serverless, both scenarios are checked via
`capabilities`, the behaviour for when the capabilities check did not
pass was delegated to the components, so we were always doing the same
fallback (show no privilege page or redirect to landing) for both
scenarios.
This is a problem for links that need to do different things in each
scenario.
### Proposal
The capability check is split to discriminate between both scenarios,
and a new computed property is introduced: `unavailable`.
Example with `securitySolutionAttackDiscovery` feature:
- When all conditions are met, PLI is enabled, and the user has the
right privileges, the capabilities are `true`:

- When we are in the RBAC scenario, where the user role does not have
the required privileges, the relevant capabilities are `false`:

- In the disabled PLI scenario, the capabilities do not even exist,
because they were not registered in the Kibana feature privileges:

We can distinguish between these scenarios and act accordingly,
consistently across the app, without relying on each route component
decision (`redirectOnMissing` prop).
### Scenarios
- **Available and authorized**:
- left nav: shown
- global search: shown
- content: the page
Serverless

Classic

- **Unauthorized**:
- left nav: hidden
- global search: hidden
- content: the generic _NoPrivilege_ page. Before this PR, we were
sometimes redirecting to the landing page (when using the
`redirectOnMissing` flag).
Serverless

Classic

- **Unavailable**: When the links needs a higher the payment plan
- **With Upselling**: (same behaviour)
- left nav: shown
- global search: hidden
- content: the registered upselling component
Serverless

Classic

- **Without Upselling**:
- left nav: hidden
- global search: hidden
- content: redirects to the landing page. Before this PR, we were
sometimes showing the _NoPrivilege_ page (when the `redirectOnMissing`
flag was missing).
Serverless

Classic

---------
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>1 parent 800340b commit e1bbcc5
File tree
30 files changed
+587
-347
lines changed- x-pack/solutions/security/plugins/security_solution/public
- app/links
- asset_inventory
- cloud_security_posture
- common
- components/security_route_page_wrapper
- lib/capabilities
- links
- configurations
- dashboards
- detections
- pages/alert_summary
- entity_analytics
- exceptions
- explore
- management
- pages
- notes
- overview
- rules
- timelines
30 files changed
+587
-347
lines changedLines changed: 103 additions & 85 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | | - | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | | - | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | | - | |
57 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
58 | 67 | | |
59 | | - | |
60 | | - | |
| 68 | + | |
| 69 | + | |
61 | 70 | | |
62 | | - | |
63 | | - | |
| 71 | + | |
| 72 | + | |
64 | 73 | | |
65 | | - | |
66 | | - | |
| 74 | + | |
67 | 75 | | |
68 | | - | |
| 76 | + | |
| 77 | + | |
69 | 78 | | |
70 | | - | |
71 | | - | |
| 79 | + | |
| 80 | + | |
72 | 81 | | |
73 | | - | |
74 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
75 | 86 | | |
76 | | - | |
77 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
78 | 90 | | |
79 | | - | |
| 91 | + | |
80 | 92 | | |
81 | | - | |
82 | | - | |
| 93 | + | |
83 | 94 | | |
84 | 95 | | |
85 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
86 | 99 | | |
87 | | - | |
88 | | - | |
| 100 | + | |
89 | 101 | | |
90 | | - | |
91 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
92 | 105 | | |
93 | | - | |
| 106 | + | |
94 | 107 | | |
95 | | - | |
96 | | - | |
| 108 | + | |
97 | 109 | | |
98 | 110 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 111 | + | |
| 112 | + | |
103 | 113 | | |
104 | | - | |
105 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
106 | 117 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 118 | + | |
110 | 119 | | |
111 | | - | |
112 | | - | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
116 | 127 | | |
117 | | - | |
118 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
119 | 133 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 134 | + | |
150 | 135 | | |
151 | 136 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
164 | 182 | | |
165 | 183 | | |
Lines changed: 35 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
96 | 100 | | |
97 | 101 | | |
98 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
99 | 105 | | |
100 | | - | |
101 | | - | |
| 106 | + | |
| 107 | + | |
102 | 108 | | |
103 | 109 | | |
104 | 110 | | |
105 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
106 | 116 | | |
107 | | - | |
108 | | - | |
| 117 | + | |
| 118 | + | |
109 | 119 | | |
110 | | - | |
111 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
112 | 123 | | |
113 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
114 | 130 | | |
115 | 131 | | |
116 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
117 | 135 | | |
118 | | - | |
| 136 | + | |
119 | 137 | | |
120 | | - | |
| 138 | + | |
121 | 139 | | |
122 | 140 | | |
123 | 141 | | |
124 | | - | |
| 142 | + | |
125 | 143 | | |
126 | 144 | | |
127 | 145 | | |
| |||
0 commit comments