Browse Source
Merge pull request #9029 from abpframework/maliming/ClearCheckModels
Add ClearCheckModels method to RequirePermissionsSimpleBatchStateChecker
pull/9030/head
liangshiwei
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
10 additions and
8 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs
-
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RequirePermissionsSimpleBatchStateChecker.cs
-
framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuManager.cs
|
|
|
@ -36,6 +36,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars |
|
|
|
|
|
|
|
using (var scope = ServiceProvider.CreateScope()) |
|
|
|
{ |
|
|
|
RequirePermissionsSimpleBatchStateChecker<ToolbarItem>.Instance.ClearCheckModels(); |
|
|
|
|
|
|
|
var context = new ToolbarConfigurationContext(ThemeManager.CurrentTheme, toolbar, scope.ServiceProvider); |
|
|
|
|
|
|
|
foreach (var contributor in Options.Contributors) |
|
|
|
|
|
|
|
@ -22,17 +22,15 @@ namespace Volo.Abp.Authorization.Permissions |
|
|
|
{ |
|
|
|
Check.NotNullOrEmpty(models, nameof(models)); |
|
|
|
|
|
|
|
foreach (var model in models) |
|
|
|
{ |
|
|
|
_models.RemoveAll(x => x.State.GetType() == model.State.GetType() && |
|
|
|
x.RequiresAll == model.RequiresAll && |
|
|
|
x.Permissions.SequenceEqual(model.Permissions)); |
|
|
|
_models.Add(model); |
|
|
|
} |
|
|
|
|
|
|
|
_models.AddRange(models); |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
public void ClearCheckModels() |
|
|
|
{ |
|
|
|
_models.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public override async Task<SimpleStateCheckerResult<TState>> IsEnabledAsync(SimpleBatchStateCheckerContext<TState> context) |
|
|
|
{ |
|
|
|
var permissionChecker = context.ServiceProvider.GetRequiredService<IPermissionChecker>(); |
|
|
|
|
|
|
|
@ -31,6 +31,8 @@ namespace Volo.Abp.UI.Navigation |
|
|
|
|
|
|
|
using (var scope = ServiceScopeFactory.CreateScope()) |
|
|
|
{ |
|
|
|
RequirePermissionsSimpleBatchStateChecker<ApplicationMenuItem>.Instance.ClearCheckModels(); |
|
|
|
|
|
|
|
var context = new MenuConfigurationContext(menu, scope.ServiceProvider); |
|
|
|
|
|
|
|
foreach (var contributor in Options.MenuContributors) |
|
|
|
|