if-permissions-directive.md 1.6 KB


title: "IfPermissionsDirective" weight: 10 date: 2023-06-13T12:31:13.111Z showtoc: true

generated: true

IfPermissionsDirective

# IfPermissionsDirective {{< generation-info sourceFile="packages/admin-ui/src/lib/core/src/shared/directives/if-permissions.directive.ts" sourceLine="33" packageName="@vendure/admin-ui">}} Conditionally shows/hides templates based on the current active user having the specified permission. Based on the ngIf source. Also support "else" templates: *Example* ```html Delete Product Not allowed! ``` The permission can be a single string, or an array. If an array is passed, then _all_ of the permissions must match (logical AND) ## Signature ```TypeScript class IfPermissionsDirective extends IfDirectiveBase> { constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef, dataService: DataService, changeDetectorRef: ChangeDetectorRef) } ``` ## Extends * IfDirectiveBase<Array<Permission[] | null>> ## Members ### constructor {{< member-info kind="method" type="(_viewContainer: ViewContainerRef, templateRef: TemplateRef<any>, dataService: DataService, changeDetectorRef: ChangeDetectorRef) => IfPermissionsDirective" >}} {{< member-description >}}{{< /member-description >}}