We need to permission role based access to files and folders in the File Management module. Can you please provide any recommendations on how to accomplish?
Thanks
Hi maliming,
That last change you suggested was the solution. Everything appears to be working now.
Right now I have that code in OnApplicationInitialization and these settings in appsettings.json
"Azure": { "SignalR": { "Enabled": "true" } }
{ "Azure:SignalR:ConnectionString": "Endpoint=https://xxxxxxx.service.signalr.net;AccessKey=xxxxxxxxxx=;Version=1.0;" }
Getting this error after implementing as suggested.
This exception was originally thrown at this call stack: [External Code] AzureSignalRPoc.Blazor.AzureSignalRPocBlazorModule.OnApplicationInitialization.AnonymousMethod__16_0(Microsoft.AspNetCore.Http.HttpContext, Microsoft.AspNetCore.Http.RequestDelegate) in AzureSignalRPocBlazorModule.cs
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var env = context.GetEnvironment();
var app = context.GetApplicationBuilder();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseAbpRequestLocalization();
if (!env.IsDevelopment())
{
app.UseErrorPage();
app.UseHsts();
}
app.UseCorrelationId();
app.UseAbpSecurityHeaders();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAbpOpenIddictValidation();
if (MultiTenancyConsts.IsEnabled)
{
app.UseMultiTenancy();
}
app.Use(async (httpContext, next) =>
{
var authenticateResultFeature = httpContext.Features.Get<IAuthenticateResultFeature>();
if (authenticateResultFeature != null && authenticateResultFeature.AuthenticateResult == null)
{
if (httpContext.User.Identity?.IsAuthenticated == true)
{
authenticateResultFeature.AuthenticateResult = AuthenticateResult.Success(new AuthenticationTicket(httpContext.User, httpContext.User.Identity.AuthenticationType!));
}
}
await next(httpContext);
});
app.UseUnitOfWork();
app.UseDynamicClaims();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "AzureSignalRPoc API");
});
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
}
1.BuildClaims(HttpContext context) at Microsoft.Azure.SignalR.NegotiateHandler
1.Process(HttpContext context)
at Microsoft.Azure.SignalR.ServiceRouteHelper.RedirectToService[THub](HttpContext context, IList1 authorizationData) at Microsoft.Azure.SignalR.NegotiateMatcherPolicy.<>c__7
1.<b__7_0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Security.Claims.AbpDynamicClaimsMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpOpenIddictMiddlewareExtension.<>c__DisplayClass0_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
[22:23:30 INF] Request finished HTTP/2 POST https://localhost:44354/_blazor/negotiate?negotiateVersion=1 - 500 null text/plain; charset=utf-8 142.9569msTrying to add AzureSignalR by following these articles https://support.abp.io/QA/Questions/2054/Using-Azure-SignalR-backplane-for-abp-Blazor-app https://support.abp.io/QA/Questions/4993/Issue-Implementing-Azure%27s-Managed-SignalR-service-with-an-ABP-Blazor-Server-application
Current configuration
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
context.Services.AddSignalR(options =>
{
options.AddFilter<AbpMultiTenantHubFilter>();
})
.AddAzureSignalR(options =>
{
options.ServerStickyMode = Microsoft.Azure.SignalR.ServerStickyMode.Required;
options.ClaimsProvider = context => new[]
{
new Claim(ClaimTypes.NameIdentifier, "testing123")
};
options.ConnectionString = "Endpoint=[redacted]";
});
.......
}
public class AbpMultiTenantHubFilter : IHubFilter
{
public virtual async ValueTask<object?> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object?>> next)
{
var currentPrincipalAccessor = invocationContext.ServiceProvider.GetRequiredService<ICurrentPrincipalAccessor>();
if (invocationContext.Context.User == null)
throw new NullReferenceException(nameof(invocationContext.Context.User));
using (currentPrincipalAccessor.Change(invocationContext.Context.User))
{
var tenantId = currentPrincipalAccessor.Principal.FindTenantId();
string? tenantName = null;
if (tenantId != null)
{
tenantName = (await invocationContext.ServiceProvider.GetRequiredService<ITenantStore>().FindAsync(tenantId.Value))?.Name;
}
using (invocationContext.ServiceProvider.GetRequiredService<ICurrentTenant>().Change(currentPrincipalAccessor.Principal.FindTenantId(), tenantName))
{
return await next(invocationContext);
}
}
}
public virtual Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
{
return Task.CompletedTask;
}
public virtual Task OnDisconnectedAsync(HubLifetimeContext context, Exception? exception, Func<HubLifetimeContext, Exception, Task> next)
{
return Task.CompletedTask;
}
}
The suite doesn't really respect custom code blocks. Especially the .Extended classes.
It would be best if those got ignored unless the file is completely missing.
Also unit tests really need a . Extended class
On Blazor Server
Issues arise when editing data: occasionally, changes to fields are not saved, and at times, modifications result in required fields being emptied.
After upgrading from 8.0.2 to 8.0.3 with Blazor Server project we get this error on startup.
System.TypeLoadException: 'Method 'ButtonStretchedLink' in type 'Blazorise.Bootstrap5.Bootstrap5ClassProvider' from assembly 'Blazorise.Bootstrap5, Version=1.3.2.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.'
That worked. Thanks.
Here's my final code for reference.
var arguments = GetToolbarComponentArguments();
Toolbar.AddComponent<DataGridColumnVisibilitySelector>(arguments);
private Dictionary<string, object?> GetToolbarComponentArguments()
{
var arguments = new Dictionary<string, object?>();
EventCallback<bool> NotesCheckedValueChanged = EventCallback.Factory.Create<bool>(this, UpdateNotesCheckedValue);
arguments.Add(nameof(NotesCheckedValueChanged), NotesCheckedValueChanged);
return arguments;
}
private async Task UpdateNotesCheckedValue(bool checkedValue)
{
NotesColumnVisible = checkedValue;
await Task.CompletedTask;
}
<DataGridColumn TItem="ScreeningWithNavigationPropertiesDto"
Field="Screening.Notes"
Caption="@L["Notes"]"
Displayable=NotesColumnVisible
Editable="true">
</DataGridColumn>
We built a button dropdown component designed to control visibility of columns on the Blazorise DataGrid.
This component works fine when embedded in the body of the page. We would like to move the button to the Toolbar to keep the look and feel consistent.
We are having trouble figuring out how to access event callbacks from the toolbar contributor.
We try to add the component like this but the event callbacks don't work.
var arguments = new Dictionary<string, object?>();
arguments.Add("SelectAllCheckedValue", SelectAllCheckedValue);
arguments.Add("TestDateCheckedValue", TestDateCheckedValue);
arguments.Add("AttachmentsCheckedValue", AttachmentsCheckedValue);
arguments.Add("AttachmentsCheckedValueChanged", AttachmentsCheckedValueChanged);
Toolbar.AddComponent<SubstanceAbuseTestsDataGridColumnVisibilityComponent>(arguments);
Here is the component referenced on the razor page.
<DataGridColumnVisibilityComponent @bind-SelectAllCheckedValue=SelectAllCheckedValue
@bind-TestDateCheckedValue=TestDateCheckedValue
@bind-AttachmentsCheckedValue=AttachmentsCheckedValue />
Here is the code behind c#
protected bool TestDateCheckedValue { get; set; }
protected bool AttachmentsCheckedValue { get; set; }
protected bool SelectAllCheckedValue { get; set; }
protected async Task SetColumnVisibilityAsync()
{
// ToDo bind cookie here
SelectAllCheckedValue = true;
TestDateCheckedValue = true;
AttachmentsCheckedValue = true;
} protected bool TestDateCheckedValue { get; set; }
protected bool AttachmentsCheckedValue { get; set; }
protected bool SelectAllCheckedValue { get; set; }
protected async Task SetColumnVisibilityAsync()
{
// ToDo bind cookie here
SelectAllCheckedValue = true;
TestDateCheckedValue = true;
AttachmentsCheckedValue = true;
}
Here is the component.
@page "/DataGridColumnVisibility"
<Dropdown>
<DropdownToggle Color="Color.Primary">
<Icon Name="IconName.Eye" /> Field Visibility
</DropdownToggle>
<DropdownMenu >
<DropdownItem ShowCheckbox Checked="SelectAllCheckedValue" CheckedChanged="UpdateSelectAllCheckedValue">Select All</DropdownItem>
<DropdownDivider />
<DropdownItem ShowCheckbox Checked="TestDateCheckedValue" CheckedChanged="UpdateTestDateCheckedValue">Test Date</DropdownItem>
<DropdownItem ShowCheckbox Checked="AttachmentsCheckedValue" CheckedChanged="UpdateAttachmentsCheckedValue">Attachments</DropdownItem>
</DropdownMenu>
</Dropdown>
@code {
[Parameter]
public bool SelectAllCheckedValue { get; set; }
[Parameter]
public EventCallback<bool> SelectAllCheckedValueChanged { get; set; }
async Task UpdateSelectAllCheckedValue()
{
SelectAllCheckedValue = !SelectAllCheckedValue;
TestDateCheckedValue = SelectAllCheckedValue;
AttachmentsCheckedValue = SelectAllCheckedValue;
await SelectAllCheckedValueChanged.InvokeAsync(SelectAllCheckedValue);
await TestDateCheckedValueChanged.InvokeAsync(TestDateCheckedValue);
await AttachmentsCheckedValueChanged.InvokeAsync(AttachmentsCheckedValue);
}
[Parameter]
public bool TestDateCheckedValue { get; set; }
[Parameter]
public EventCallback<bool> TestDateCheckedValueChanged { get; set; }
protected async Task UpdateTestDateCheckedValue()
{
TestDateCheckedValue = !TestDateCheckedValue;
await TestDateCheckedValueChanged.InvokeAsync(TestDateCheckedValue);
}
[Parameter]
public bool AttachmentsCheckedValue { get; set; }
[Parameter]
public EventCallback<bool> AttachmentsCheckedValueChanged { get; set; }
protected async Task UpdateAttachmentsCheckedValue()
{
AttachmentsCheckedValue = !AttachmentsCheckedValue;
await AttachmentsCheckedValueChanged.InvokeAsync(AttachmentsCheckedValue);
}
}
We use this on the Displayable property of the DataGrid column
<DataGridColumn TItem="ExampleDto"
Field="TestDate"
Displayable=TestDateCheckedValue
Editable="true"
Caption="@L["TestDate"]">
<DisplayTemplate>
@context.TestDate.ToShortDateString()
</DisplayTemplate>
</DataGridColumn>
[Parameter]
public EventCallback<bool> AttachmentsCheckedValueChanged { get; set; }
protected async Task UpdateAttachmentsCheckedValue()
{
AttachmentsCheckedValue = !AttachmentsCheckedValue;
await AttachmentsCheckedValueChanged.InvokeAsync(AttachmentsCheckedValue);
}
}
From the last youtube podcast these are the most important features to us.
Bind to User Entities in ABP Suite Most important PDF export support Very important File/Image as a property type Uploads of multiple files on a record