A. A custom entity privileges, it can be directly used abp class of PermissionNames
II. PermissionChecker method of rewriting IsGrantedAsync
public override async Task<bool> IsGrantedAsync(string permissionName) { var dd = permissionName; var flag = false; if (AbpSession.UserId.HasValue) { var ddd = _permissionRoleRepository.GetAllList(); if (_permissionRoleRepository.GetAllList(c => c.UserId == AbpSession.UserId && c.Name == permissionName).Count() > 0) { flag = true; } } return flag; }
I used here is a list of user roles defined permissionRole own table, look up the user in this table whether to have this privilege.
III. In the above method of adding
[AbpAuthorize(PermissionNames.Pages)]
The authority granted herein is a method of pages, will complain if there is no 415, no permission