- ABP Framework version: v3.0.3
- UI type: Angular
- Identity Server Seperated: no
Hello. This is a follow-up from a question a while back about removing functionality from the UI and API: https://support.abp.io/QA/Questions/255
By disabling the permissions to Organization Units and Claim Types we were able to remove these elements from the navigation:
//Remove the Organization Unit functionality by overriding permissions and setting it to not enabled/granted
context.GetPermissionOrNull(IdentityPermissions.OrganizationUnits.Default).IsEnabled = false;
context.GetPermissionOrNull(IdentityPermissions.OrganizationUnits.ManageOU).IsEnabled = false;
context.GetPermissionOrNull(IdentityPermissions.OrganizationUnits.ManageRoles).IsEnabled = false;
context.GetPermissionOrNull(IdentityPermissions.OrganizationUnits.ManageUsers).IsEnabled = false;
//Remove the Claim Types functionality by overriding permissions and setting it to not enabled/granted
context.GetPermissionOrNull(IdentityPermissions.ClaimTypes.Default).IsEnabled = false;
context.GetPermissionOrNull(IdentityPermissions.ClaimTypes.Create).IsEnabled = false;
context.GetPermissionOrNull(IdentityPermissions.ClaimTypes.Delete).IsEnabled = false;
context.GetPermissionOrNull(IdentityPermissions.ClaimTypes.Update).IsEnabled = false;
However, this did not stop these elements from appearing in other areas in the app:
Organization Units tab still appears on Create/Edit User: When the modal opens to create or edit a user, the organization units tab is still present, but because the permission is disabled, it throws an error.
Claims still appears in User and Role action dropdown: On the user and role tables, a
Claims
option is still present, and clicking will still getclaim-types
andclaims
for that user or role successfully and allows adding or updating claims with no errors. It seems that is because these endpoints check theIdentityPermissions.Roles/Users.Default/Update
permissions and not any related toIdentityPermissions.ClaimTypes
.
Am I correct in assuming that these elements should be hidden if these permissions are disabled? If so, could these extra permission checks be added to the Identity Module to prevent this unexpected behavior? If not, what would be the best way for me to manually hide these elements?
Thanks for the help, Jack
5 Answer(s)
-
0
Hi,
You need to override UI interface. See https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-User-Interface
-
0
Is there somewhere I can download the default
html
andts
source code for these components? Downloading the source code of the modules from the suite seems to only havecshtml
files. Would I need to manually convert everything but the part I need to change to override in Angular? -
0
Hi @jackmcelhinney
It seems a bug. We'll fix the problem. You won't need to override the Angular UI.
-
0
We have created an issue about this. We'll probably add new permissions for user management in v3.1.
The permissions you have disabled don't affect another page. E.g if you disable all organization units permissions, the organization units tab in the users page don't be hidden.
1- You can modify all buttons under an actions button. See the Entity Action Extensions for Angular UI document to learn how can you be done it.
2- As of v3.0.5, you can hide the "Organization Units" tab with some style codes.
Open the
styles.scss
file in thesrc
folder and add the following:#user-nav-tabs #user-organization-units { display: none; }
Second way is temporary. Please use new permissions to hide/show the "Organization Units" tab and remove the style above in v3.1. HTML IDs can be changed or removed, not reliable for development.
We also fixed the authorization error above. We'll release the v3.0.5 soon.
Thanks for reporting ☺️
-
0
Excellent. Thanks for the help!