IpCanPipe
The IpCanPipe is a pipe that checks if the end user can or cannot perform an action based on the AIPEmailBuilderMiddlewareService.can method.
This method checks if the end user can or cannot perform an action based on the middleware's
can
method.Parameters:
entity
— The email builder entity object. It can be of typeAIPEmailBuilderBlockExtendedOptions
,IStructure
, orIPEmail
.action
— The action to be performed. It can be of typemiddlewareBlockActions
,middlewareStructureActions
, ormiddlewareEmailActions
.
Returns:
- A boolean value that indicates whether the user can perform the specified action on the given entity.
Here's an example:
<div *ngIf="block | ipCan: 'delete'">
<button (click)="onDeleteBlock()">Delete Block</button>
</div>
In this example, the
*ngIf
directive uses the IpCanPipe
to check if the current user has permission to delete the block
component. If the user has permission, the delete button is displayed. If not, the button is hidden.Last modified 4mo ago