Overview
The Permissions API provides endpoints for retrieving user permissions. Permissions are derived from the user’s assigned roles and group memberships.Get Current User Permissions
Retrieve all permissions for the currently authenticated user.HTTP Request
GET /api/v1/identity/permissions
Authorization
RequiresPermissions.Users.View permission. The user ID is automatically extracted from the JWT access token.
Response
Returns an array of permission strings.List of all permissions granted to the user through direct role assignments and group memberships
Response Example
Permission Structure
Permissions in the FullStackHero .NET Starter Kit follow a hierarchical naming convention:Common Permission Modules
Permissions.Users.ViewPermissions.Users.CreatePermissions.Users.UpdatePermissions.Users.DeletePermissions.Roles.ViewPermissions.Roles.CreatePermissions.Roles.UpdatePermissions.Roles.DeletePermissions.Groups.ViewPermissions.Groups.CreatePermissions.Groups.UpdatePermissions.Groups.DeletePermissions.Groups.ManageMembersPermissions.Sessions.ViewPermissions.Sessions.Revoke
Permissions.Tenants.ViewPermissions.Tenants.CreatePermissions.Tenants.UpdatePermissions.Tenants.Delete
Permissions.AuditTrails.ViewPermissions.AuditTrails.Export
Permission Resolution
User permissions are calculated by combining:- Direct Role Assignments: Permissions from roles directly assigned to the user
- Group Memberships: Permissions from roles assigned to groups the user belongs to
- System Roles: Built-in roles like Administrator that may have special privileges
Example Permission Flow
Using Permissions in Code
Endpoint Authorization
Endpoints use the.RequirePermission() extension to enforce permission checks:
Permission Constants
Permission strings are defined as constants in theIdentityPermissionConstants class:
Best Practices
Least Privilege Principle: Always assign the minimum permissions necessary for users to perform their duties.
Related Endpoints
- Update Role Permissions - Assign permissions to roles
- Get User Roles - View roles assigned to a user
- Get User Groups - View groups a user belongs to
