File

packages/components/directives/eui-has-permission.directive.ts

Description

A structural directive that conditionally renders content based on user permissions. Similar to *ngIf, but checks against a permission service to determine visibility.

Example :
```HTML
<!-- Single permission check -->
<div *euiHasPermission="['READ_USERS']">
  Content only visible to users with READ_USERS permission
</div>
Content only visible to users with both permissions
Content visible to users with either permission
```

The directive performs an AND operation when multiple permissions are provided, meaning all permissions must be granted for the content to be displayed.

Metadata

Index

Inputs
Accessors

Inputs

euiHasPermission
Type : any
euiHasPermissionOperator
Type : ConditionOperator

Sets the logical operator for permission checks. Can be 'AND' (default) or 'OR'.

  • 'AND': All permissions must be granted to display the content.
  • 'OR': At least one permission must be granted to display the content.

Accessors

euiHasPermissionOperator
seteuiHasPermissionOperator(operator: ConditionOperator)

Sets the logical operator for permission checks. Can be 'AND' (default) or 'OR'.

  • 'AND': All permissions must be granted to display the content.
  • 'OR': At least one permission must be granted to display the content.
Parameters :
Name Type Optional
operator ConditionOperator No
Returns : void
euiHasPermission
seteuiHasPermission(val)

Sets the permissions required to display the content. Can be a single permission string or an array of permission strings.

Parameters :
Name Optional Description
val No
  • Permission or array of permissions to check
Returns : void

results matching ""

    No results matching ""