Filter by title
There is a newer version of this document!

ASP.NET Core MVC / Razor Pages UI: JavaScript Auth API

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.

Basic Usage

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!");
}

Other Fields & Functions

  • abp.auth.isAnyGranted(...): Gets one or more permission/policy names and returns true if at least one of them has granted.
  • abp.auth.areAllGranted(...): Gets one or more permission/policy names and returns true if 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.

Contributors


Last updated: September 15, 2022 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

ABP Community Talks
.NET Aspire in ABP Studio: Build, Run & Scale Modern .NET Apps
16 Oct, 17:00
Online
Register Now
ABP Live Webinar
Webinar Calendar Webinar Calendar
Discover
ABP Platform
Register Now
Oct 15
Wednesday,
17:00 UTC
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book