//[doc-seo]
{
"Description": "Learn how to utilize the JavaScript Auth API in ABP Framework to manage user permissions and conditionally adjust your UI."
}Auth API allows you to check permissions (policies) for the current user in the client side. In this way, you can conditionally show/hide UI parts or perform your client side logic based on the current permissions.
This document only explains the JavaScript API. See the authorization document to understand the ABP authorization & permission system.
abp.auth.isGranted(...) function is used to check if a permission/policy has granted or not:
if (abp.auth.isGranted('DeleteUsers')) {
//TODO: Delete the user
} else {
alert("You don't have permission to delete a user!");
}abp.auth.isAnyGranted(...): Gets one or more permission/policy names and returnstrueif at least one of them has granted.abp.auth.areAllGranted(...): Gets one or more permission/policy names and returnstrueif all of them of them have granted.abp.auth.grantedPolicies: This is an object where its keys are the permission/policy names. You can find the granted permission/policy names here.