User permission management view does not include client-level (C) grants, while grantedPolicies does
Is there an existing issue for this?
- I have searched the existing issues
Description
For the same user, two ABP APIs report different effective permissions:
GET /api/abp/application-configuration→auth.grantedPoliciesincludes permissions granted to the client (providerName = "C").GET /api/permission-management/permissions?providerName=U&providerKey={userId}→ the same permission is not granted in the user view and has nograntedProvidersentry — although role-derived grants (providerName = "R") do appear there.
So when a user effectively has a permission because it was granted at the client level, the permission-management UI cannot show where it comes from. This is confusing for admins auditing "what can this user do" and for developers debugging authorization.
Reproduction Steps
Grant a permission to a client (OpenIddict → Applications → {ClientId} → Permissions), or via API:
PUT /api/permission-management/permissions?providerName=C&providerKey={ClientId} { "permissions": [ { "name": "AbpIdentity.Users", "isGranted": true } ] }Sign in as a user with no roles and no user-level grants. The token is issued to the same client, so it carries the
client_idclaim.GET /api/abp/application-configuration→auth.grantedPoliciescontains"AbpIdentity.Users": true.GET /api/permission-management/permissions?providerName=U&providerKey={userId}→AbpIdentity.UsershasisGranted: falseand an emptygrantedProviders.
For comparison: when the same permission is granted to one of the user's roles, step 4 reports isGranted: true with an R entry in grantedProviders.
Expected behavior
Either:
- the permission-management view for a user also lists client-level grants (as
grantedProvidersentries withproviderName = "C"), so the admin UI explains the effective permissions consistently; or - if the current behavior is intended, the documentation states explicitly that client-level grants also apply to regular user tokens (and therefore to every user of that client).
Actual behavior
Role-derived grants are merged into the user view (RolePermissionManagementProvider has an explicit branch for providerName == "U"), but client-derived grants are not. The two APIs disagree without any documentation of this asymmetry.
Regression?
Unknown / probably not a regression. I did not find a recent change to the involved providers; the behavior looks long-standing.
Known Workarounds
Do not grant permissions to clients unless the intent is that every user of that client gets them. When auditing effective permissions, check both the user view and the client view.
Version
10.4.0 (also verified against the current dev source)
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
Source reading:
- Management side:
PermissionManager.GetInternalAsyncloops over the registeredIPermissionManagementProviders. The basePermissionManagementProvider.CheckAsyncreturns an empty result whenproviderName != Name. The only special case isRolePermissionManagementProvider, which — when asked about a user (providerName == "U"and the key parses as a user id) — also loads that user's roles and merges their grants. There is no equivalent branch for client grants. - Runtime side:
PermissionChecker.IsGrantedAsync(name)iteratesAbpPermissionOptions.ValueProviders(U, R, C) and returnstrueif any provider grants.ClientPermissionValueProviderreadsAbpClaimTypes.ClientIdfrom the current principal — which is present on regular user tokens too, not only onclient_credentialstokens. - The docs for
ClientPermissionValueProvideronly say it is "especially useful on a machine to machine interaction where there is no current user", which does not make the user-token behavior explicit.
Questions:
- Is it intended that a permission granted to a client applies to every user signing in through that client?
- If yes, should the user view include
Centries ingrantedProviders? If the role merge is intentionally the limit, could this asymmetry please be documented?
Source: abpframework/abp