@eui/core 17.0.0-rc.8 → 17.0.1-snapshot-1700665462888

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,6 +108,7 @@
108
108
  "eui.uxtree.SELECT-ALL": "Select all",
109
109
  "eui.uxtree.UNSELECT-ALL": "Unselect all",
110
110
  "eui.languageSelector.modalTitle": "Select language",
111
+ "eui.growl.dismiss-all": "Dismiss all",
111
112
  "eui.euitable.NO-SORTING-ICON": "No sorting icon",
112
113
  "eui.euitable.ASCENDING-ICON": "Ascending order icon",
113
114
  "eui.euitable.DESCENDING-ICON": "Descending order icon",
@@ -249,9 +249,9 @@
249
249
  <li>
250
250
  <b>@stackblitz/sdk</b> : 1.9.0</li>
251
251
  <li>
252
- <b>@eui/styles-base</b> : 17.0.0-rc.7</li>
252
+ <b>@eui/styles-base</b> : 17.0.1-snapshot-1700608878397</li>
253
253
  <li>
254
- <b>@eui/ecl</b> : 17.0.0-rc.7</li>
254
+ <b>@eui/ecl</b> : 17.0.1-snapshot-1700608878397</li>
255
255
  <li>
256
256
  <b>@eui/tools</b> : ^6.0.0</li>
257
257
  </ul>
@@ -63,6 +63,22 @@
63
63
  </p>
64
64
 
65
65
 
66
+ <p class="comment">
67
+ <h3>Description</h3>
68
+ </p>
69
+ <p class="comment">
70
+ <p>Service for managing user permissions within the application.
71
+ This class extends <code>EuiService</code> and is responsible for handling user rights and permissions.
72
+ It provides methods to initialize the service with user rights, check specific rights and permissions,
73
+ and subscribe to changes in the user rights state.</p>
74
+ <p>See EuiService</p>
75
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-html">// Example of using the EuiPermissionService in an application
76
+ const permissionService = new EuiPermissionService();
77
+ permissionService.init([{ id: &#39;ADMIN&#39;, permissions: [&#39;CREATE&#39;, &#39;READ&#39;, &#39;UPDATE&#39;, &#39;DELETE&#39;] }]);
78
+ if (permissionService.checkRight(&#39;ADMIN&#39;)) {
79
+ console.log(&#39;User has ADMIN rights&#39;);
80
+ }</code></pre></div>
81
+ </p>
66
82
 
67
83
  <p class="comment">
68
84
  <h3>Extends</h3>
@@ -198,10 +214,15 @@
198
214
 
199
215
  <tr>
200
216
  <td class="col-md-4">
201
- <div class="io-description"><p>accepts a string of right and or a permission. In string first comes the right and or followed by permission in
202
- a dot separated way e.g. &#39;RIGHT.PERMISSION&#39; or &#39;RIGHT&#39;. The string can contain more that 2 separated fields.
203
- In that case the last field should be the permission and all the others a Right. e.g. &#39;RIGHT1.RIGHT2.PERMISSION&#39;
204
- The last part is useful where you want a user to have multiple rights and the permission of the last right.</p>
217
+ <div class="io-description"><p>Checks if the user has the specified attribute permission.
218
+ This method interprets a string that represents a combination of rights and/or permissions
219
+ and determines whether the user has the specified permissions. The string format can be
220
+ &#39;RIGHT.PERMISSION&#39; or just &#39;RIGHT&#39;. For multiple rights, it can be &#39;RIGHT1.RIGHT2.PERMISSION&#39;.</p>
221
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-none"> Format can be &#39;RIGHT&#39;, &#39;RIGHT.PERMISSION&#39;, or &#39;RIGHT1.RIGHT2.PERMISSION&#39;.</code></pre></div><b>Example :</b><div><pre class="line-numbers"><code class="language-html">// Check a single right
222
+ const hasRight = permissionService.checkAttributePermission(&#39;VIEW&#39;);</code></pre></div><p>// Check a right with a specific permission
223
+ const hasRightWithPermission = permissionService.checkAttributePermission(&#39;EDIT.APPROVE&#39;);</p>
224
+ <p>// Check multiple rights with a specific permission
225
+ const hasMultipleRights = permissionService.checkAttributePermission(&#39;ADMIN.VIEW.APPROVE&#39;);</p>
205
226
  </div>
206
227
 
207
228
  <div class="io-description">
@@ -213,6 +234,7 @@ The last part is useful where you want a user to have multiple rights and the pe
213
234
  <td>Name</td>
214
235
  <td>Type</td>
215
236
  <td>Optional</td>
237
+ <td>Description</td>
216
238
  </tr>
217
239
  </thead>
218
240
  <tbody>
@@ -227,6 +249,13 @@ The last part is useful where you want a user to have multiple rights and the pe
227
249
  </td>
228
250
 
229
251
 
252
+ <td>
253
+ <ul>
254
+ <li>A string representing the rights and/or permissions to check.
255
+ Format can be &#39;RIGHT&#39;, &#39;RIGHT.PERMISSION&#39;, or &#39;RIGHT1.RIGHT2.PERMISSION&#39;.</li>
256
+ </ul>
257
+
258
+ </td>
230
259
  </tr>
231
260
  </tbody>
232
261
  </table>
@@ -236,7 +265,8 @@ The last part is useful where you want a user to have multiple rights and the pe
236
265
 
237
266
  </div>
238
267
  <div class="io-description">
239
-
268
+ <p>True if the user has the specified attribute permission, false otherwise.</p>
269
+
240
270
  </div>
241
271
  </td>
242
272
  </tr>
@@ -264,8 +294,10 @@ The last part is useful where you want a user to have multiple rights and the pe
264
294
 
265
295
  <tr>
266
296
  <td class="col-md-4">
267
- <div class="io-description"><p>check if a user has that right and that right has the permission given.</p>
268
- </div>
297
+ <div class="io-description"><p>Checks if the user has a specific permission within a right.
298
+ This method determines whether the user has a specific permission associated with a given right.</p>
299
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-html">// Check if the user has &#39;APPROVE&#39; permission in the &#39;EDIT&#39; right
300
+ const canApproveEdit = permissionService.checkPermission(&#39;EDIT&#39;, &#39;APPROVE&#39;);</code></pre></div></div>
269
301
 
270
302
  <div class="io-description">
271
303
  <b>Parameters :</b>
@@ -292,7 +324,9 @@ The last part is useful where you want a user to have multiple rights and the pe
292
324
 
293
325
 
294
326
  <td>
295
- <p>the right of the user</p>
327
+ <ul>
328
+ <li>The ID of the right.</li>
329
+ </ul>
296
330
 
297
331
  </td>
298
332
  </tr>
@@ -308,7 +342,9 @@ The last part is useful where you want a user to have multiple rights and the pe
308
342
 
309
343
 
310
344
  <td>
311
- <p>the permission of the right</p>
345
+ <ul>
346
+ <li>The permission to check within the right.</li>
347
+ </ul>
312
348
 
313
349
  </td>
314
350
  </tr>
@@ -320,7 +356,8 @@ The last part is useful where you want a user to have multiple rights and the pe
320
356
 
321
357
  </div>
322
358
  <div class="io-description">
323
-
359
+ <p>True if the user has the specified permission in the given right, false otherwise.</p>
360
+
324
361
  </div>
325
362
  </td>
326
363
  </tr>
@@ -348,8 +385,10 @@ The last part is useful where you want a user to have multiple rights and the pe
348
385
 
349
386
  <tr>
350
387
  <td class="col-md-4">
351
- <div class="io-description"><p>check if a user has the right.</p>
352
- </div>
388
+ <div class="io-description"><p>Checks if the user has a specific right.
389
+ This method determines whether the user possesses a particular right identified by its ID.</p>
390
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-html">// Check if the user has the &#39;ADMIN&#39; right
391
+ const isAdmin = permissionService.checkRight(&#39;ADMIN&#39;);</code></pre></div></div>
353
392
 
354
393
  <div class="io-description">
355
394
  <b>Parameters :</b>
@@ -376,7 +415,9 @@ The last part is useful where you want a user to have multiple rights and the pe
376
415
 
377
416
 
378
417
  <td>
379
- <p>the id of Right</p>
418
+ <ul>
419
+ <li>The ID of the right to check.</li>
420
+ </ul>
380
421
 
381
422
  </td>
382
423
  </tr>
@@ -388,7 +429,8 @@ The last part is useful where you want a user to have multiple rights and the pe
388
429
 
389
430
  </div>
390
431
  <div class="io-description">
391
-
432
+ <p>True if the user has the specified right, false otherwise.</p>
433
+
392
434
  </div>
393
435
  </td>
394
436
  </tr>
@@ -424,13 +466,28 @@ The last part is useful where you want a user to have multiple rights and the pe
424
466
 
425
467
  <tr>
426
468
  <td class="col-md-4">
427
- <div class="io-description"><p>get the user&#39;s Rights from the state</p>
469
+ <div class="io-description"><p>Retrieves the current state of user rights by subscribing to changes.
470
+ This method is used to access the current state of user rights in the service. It returns an Observable
471
+ that emits the current user rights. The method is generic and can be parameterized to return a specific
472
+ type that extends from <code>EuiUserRight[]</code>.</p>
473
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-none"> The type of the emitted value is `K`, which is `EuiUserRight[]` by default.</code></pre></div><b>Example :</b><div><pre class="line-numbers"><code class="language-html">// Example of subscribing to the user rights state
474
+ permissionService.getState().subscribe(currentRights =&gt; {
475
+ console.log(&#39;Current User Rights:&#39;, currentRights);
476
+ });</code></pre></div><p>// Example with a specific type
477
+ permissionService.getState&lt;CustomUserRightType[]&gt;().subscribe(customRights =&gt; {
478
+ console.log(&#39;Custom User Rights:&#39;, customRights);
479
+ });</p>
428
480
  </div>
429
481
 
430
482
  <div class="io-description">
431
483
  <b>Returns : </b> <code>Observable&lt;K&gt;</code>
432
484
 
433
485
  </div>
486
+ <div class="io-description">
487
+ <p>An Observable that emits the current state of user rights.
488
+ The type of the emitted value is <code>K</code>, which is <code>EuiUserRight[]</code> by default.</p>
489
+
490
+ </div>
434
491
  </td>
435
492
  </tr>
436
493
  </tbody>
@@ -457,8 +514,26 @@ The last part is useful where you want a user to have multiple rights and the pe
457
514
 
458
515
  <tr>
459
516
  <td class="col-md-4">
460
- <div class="io-description"><p>initialize the service by providing a state</p>
461
- </div>
517
+ <div class="io-description"><p>Initializes the permission service with a set of user rights.
518
+ This method sets up the initial state of the service based on the provided user rights.
519
+ It should be called before using other methods of the service to ensure it is properly configured.</p>
520
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-none"> Each `EuiUserRight` object should contain at least an `id` property,
521
+ and optionally a `permissions` property which is an array of strings.
522
+
523
+ The status object includes a `success` boolean indicating
524
+ whether the initialization was successful, and an `error` property
525
+ with a message in case of failure.</code></pre></div><b>Example :</b><div><pre class="line-numbers"><code class="language-html">// Example of initializing the service with two user rights
526
+ const userRights = [
527
+ { id: &#39;ADMIN&#39;, permissions: [&#39;CREATE&#39;, &#39;READ&#39;, &#39;UPDATE&#39;, &#39;DELETE&#39;] },
528
+ { id: &#39;USER&#39;, permissions: [&#39;READ&#39;] }
529
+ ];
530
+ permissionService.init(userRights).subscribe(status =&gt; {
531
+ if (status.success) {
532
+ console.log(&#39;Initialization successful&#39;);
533
+ } else {
534
+ console.error(&#39;Initialization failed:&#39;, status.error);
535
+ }
536
+ });</code></pre></div></div>
462
537
 
463
538
  <div class="io-description">
464
539
  <b>Parameters :</b>
@@ -469,6 +544,7 @@ The last part is useful where you want a user to have multiple rights and the pe
469
544
  <td>Name</td>
470
545
  <td>Type</td>
471
546
  <td>Optional</td>
547
+ <td>Description</td>
472
548
  </tr>
473
549
  </thead>
474
550
  <tbody>
@@ -483,6 +559,14 @@ The last part is useful where you want a user to have multiple rights and the pe
483
559
  </td>
484
560
 
485
561
 
562
+ <td>
563
+ <ul>
564
+ <li>An array of user rights to initialize the service with.
565
+ Each <code>EuiUserRight</code> object should contain at least an <code>id</code> property,
566
+ and optionally a <code>permissions</code> property which is an array of strings.</li>
567
+ </ul>
568
+
569
+ </td>
486
570
  </tr>
487
571
  </tbody>
488
572
  </table>
@@ -492,7 +576,11 @@ The last part is useful where you want a user to have multiple rights and the pe
492
576
 
493
577
  </div>
494
578
  <div class="io-description">
495
-
579
+ <p>An Observable that emits the status of the initialization.
580
+ The status object includes a <code>success</code> boolean indicating
581
+ whether the initialization was successful, and an <code>error</code> property
582
+ with a message in case of failure.</p>
583
+
496
584
  </div>
497
585
  </td>
498
586
  </tr>
@@ -520,8 +608,16 @@ The last part is useful where you want a user to have multiple rights and the pe
520
608
 
521
609
  <tr>
522
610
  <td class="col-md-4">
523
- <div class="io-description"><p>update the state with the given user&#39;s rights</p>
524
- </div>
611
+ <div class="io-description"><p>Updates the state of the service with a new set of user rights.
612
+ This method is used to modify the current user rights in the service. It takes an array of <code>EuiUserRight</code>
613
+ objects and updates the service&#39;s state. This change is then propagated to all subscribers of the state.</p>
614
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-none"> Each `EuiUserRight` object should contain an `id` property,
615
+ and optionally a `permissions` property which is an array of strings.</code></pre></div><b>Example :</b><div><pre class="line-numbers"><code class="language-html">// Example of updating the service&#39;s state with new user rights
616
+ const newUserRights = [
617
+ { id: &#39;USER&#39;, permissions: [&#39;READ&#39;, &#39;COMMENT&#39;] },
618
+ { id: &#39;MODERATOR&#39;, permissions: [&#39;READ&#39;, &#39;WRITE&#39;, &#39;DELETE&#39;] }
619
+ ];
620
+ permissionService.updateState(newUserRights);</code></pre></div></div>
525
621
 
526
622
  <div class="io-description">
527
623
  <b>Parameters :</b>
@@ -532,6 +628,7 @@ The last part is useful where you want a user to have multiple rights and the pe
532
628
  <td>Name</td>
533
629
  <td>Type</td>
534
630
  <td>Optional</td>
631
+ <td>Description</td>
535
632
  </tr>
536
633
  </thead>
537
634
  <tbody>
@@ -546,6 +643,14 @@ The last part is useful where you want a user to have multiple rights and the pe
546
643
  </td>
547
644
 
548
645
 
646
+ <td>
647
+ <ul>
648
+ <li>An array of <code>EuiUserRight</code> objects to update the service&#39;s state with.
649
+ Each <code>EuiUserRight</code> object should contain an <code>id</code> property,
650
+ and optionally a <code>permissions</code> property which is an array of strings.</li>
651
+ </ul>
652
+
653
+ </td>
549
654
  </tr>
550
655
  </tbody>
551
656
  </table>