protected virtual async Task RevokeAsync(Guid menuId, string providerKey) { var permissionGrant = await MenuGrantRepository.FindAsync(menuId, Name, providerKey); if (permissionGrant == null) { return; } await MenuGrantRepository.DeleteAsync(permissionGrant); }
private async Task InsertMenuGrantAsync(DataSeedContext context) { foreach (var menuId in await MenuDataSeedProvider.GetGrantMenuIdsAsync(context)) { if ((await MenuGrantRepository.FindAsync(menuId, "R", AdminRoleName)) != null) { continue; } await MenuGrantRepository.InsertAsync(new MenuGrant( GuidGenerator.Create(), menuId, "R", AdminRoleName, context.TenantId)); } }
protected virtual async Task GrantAsync(Guid menuId, string providerKey) { var menuGrant = await MenuGrantRepository.FindAsync(menuId, Name, providerKey); if (menuGrant != null) { return; } await MenuGrantRepository.InsertAsync( new MenuGrant( GuidGenerator.Create(), menuId, Name, providerKey, CurrentTenant.Id ) ); }