### File

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

### Description

Structural directive conditionally rendering content based on user permissions. Checks permissions via EuiPermissionService and shows/hides content accordingly. Supports single or multiple permission checks with AND/OR logical operators. Similar to *ngIf but permission-based instead of boolean-based.

Single permission:

Example :

    <button *euiHasPermission="['EDIT_USER']">Edit</button>

Multiple permissions (AND - all required):

Example :

    <div *euiHasPermission="['READ_DATA', 'WRITE_DATA']">
      Admin content
    </div>

Multiple permissions (OR - any required):

Example :

    <div *euiHasPermission="['MANAGER', 'ADMIN']" euiHasPermissionOperator="OR">
      Manager or Admin content
    </div>

### Accessibility

- Content completely removed from DOM when permissions not granted
- No visual indication of hidden content to unauthorized users
- Screen readers will not encounter permission-restricted content

### Notes

- Default operator is AND (all permissions required)
- Use OR operator when any single permission should grant access
- Requires EuiPermissionService to be configured in application
- Permission checks happen synchronously on directive initialization and input changes

### Metadata

Selector | `[euiHasPermission]`

### Index

###### Inputs
euiHasPermission euiHasPermissionOperator
###### Accessors
euiHasPermissionOperator euiHasPermission

### Inputs

euiHasPermission
Type : `any`
Array of permission strings required to display the content. Can be single permission or multiple permissions.

euiHasPermissionOperator
Type : `ConditionOperator`
Sets the logical operator for permission checks. 'AND' requires all permissions, 'OR' requires at least one permission. Default: 'AND'

### Accessors

euiHasPermissionOperator
set `euiHasPermissionOperator(operator: ConditionOperator)`
Sets the logical operator for permission checks. 'AND' requires all permissions, 'OR' requires at least one permission. Default: 'AND' Parameters :
Name | Type | Optional
operator | `ConditionOperator` | No
Returns : `void`

euiHasPermission
set `euiHasPermission(val: unknown)`
Array of permission strings required to display the content. Can be single permission or multiple permissions. Parameters :
Name | Type | Optional
val | `unknown` | No
Returns : `void`

# results matching ""

# No results matching ""