I'm using a custom error handler implemented per the documentation, and it is working fine, but I'm getting console errors after it handles the errors.
-- In my error handler, I am marking the error as handled and only re-throwing it if not handled:
-- When debugging it I can see that the framework is still wanting to handle the error, but the error is null
<br> -- When it finally gets to the point that it wants to execute, it fails because it can't access the status of the error
Please let me know if this is a bug or if I'm doing something wrong. Also I'm using the AbpAuthorizationException to throw errors but the message is not being received at the client, it just arrives as a 403 I was expecting to see the message I was trying to send back. Thanks.
I'm deploying ABP to Azure app services, I'm worried that the messages I'm sending using the service bus end up in the staging slot and are processed by an outdated version of my application. I can see in application insights that both my production and staging slots are connected to the same topic. Does the framework already control that or do I have to somehow disable the service bus on the staging slot?
I was having the same issue with Hangfire, but I solved it this way:
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = !hostingEnvironment.IsStaging();
});
Thanks.
Yeah, that's what I have, not sure if there was another way. Do you know how it is handled by the framework, is there any source code I can reference?
I have created my own custom configuration service and added it to the app.module as a provider:
{
provide: APP_INITIALIZER,
useFactory: configurationFactory,
deps: [ConfigurationService, ConfigStateService],
multi: true,
},
There are configuration properties that I need before authentication and after authentication, how can I call my configuration service after the user has authenticated to refresh the configuration properties?
I see this being done already by the abp framework, how can I achieve the same?
Thanks.
Thank you, that worked. Is that the recommended way of doing it? I thought that replacing the service would have been the right approach but for some reason, it looks like it was calling my custom class SeedAsync and the framework's SeedAsync method too.
I've followed some documents online and looked at the source code for how to replace the PermissionDataSeedContributor but when running the DbMigrator I end up with twice the permissions, one set for the default "admin" role and another set for my custom role.
Here's my code:
using CompuCare.Enums;
using CompuCare.Permissions;
using Microsoft.AspNetCore.Identity;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement;
using Volo.Abp.Uow;
namespace CompuCare.DataSeed;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(PermissionDataSeedContributor), typeof(IDataSeedContributor))]
public class PermissionDataSeedContributor : IDataSeedContributor, ITransientDependency
{
private readonly ICurrentTenant _currentTenant;
private readonly IPermissionDefinitionManager _permissionDefinitionManager;
private readonly IPermissionDataSeeder _permissionDataSeeder;
public PermissionDataSeedContributor(
ICurrentTenant currentTenant,
IPermissionDefinitionManager permissionDefinitionManager,
IPermissionDataSeeder permissionDataSeeder)
{
_currentTenant = currentTenant;
_permissionDefinitionManager = permissionDefinitionManager;
_permissionDataSeeder = permissionDataSeeder;
}
public async Task SeedAsync(DataSeedContext context)
{
await PopulateAbpPermissionsAsync(context);
}
private async Task PopulateAbpPermissionsAsync(DataSeedContext context)
{
var multiTenancySide = _currentTenant.GetMultiTenancySide();
var providerKey = multiTenancySide == MultiTenancySides.Host ? "admin" : "Administrators";
var permissionNames = (await _permissionDefinitionManager.GetPermissionsAsync())
.Where(p => p.MultiTenancySide.HasFlag(multiTenancySide))
.Where(p => !p.Providers.Any() || p.Providers.Contains(RolePermissionValueProvider.ProviderName))
.Select(p => p.Name)
.ToArray();
await _permissionDataSeeder.SeedAsync(
RolePermissionValueProvider.ProviderName,
providerKey,
permissionNames,
context?.TenantId
);
}
}
Could you please provide an example and where should I put that file?
I created a class and implemented the IsRedirectAllowedUrl, but I needed to implement other methods too and now it fails when calling the other methods because they don't have a real implementation, I'm just returning a default value. Is there a way to just implement the IsRedirectAllowedUrl method?
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.UI.Navigation.Urls;
namespace CompuCare.Providers;
public class CustomAppUrlProvider : IAppUrlProvider, ITransientDependency
{
public bool IsRedirectAllowedUrl(string url)
{
return true;
}
public async Task<string> GetUrlAsync(string appName, string urlName)
{
return default;
}
public async Task<string> GetUrlOrNullAsync(string appName, string urlName)
{
return default;
}
public async Task<string> NormalizeUrlAsync(string url)
{
return default;
}
}
It's not working, still getting the same :
2023-12-15 07:07:42.296 +00:00 [ERR] Invalid RedirectUrl: https://tenanta.ccalp.dev/account/login, Use AppUrlProvider to configure it!
"App": { "SelfUrl": "https://{{tenantName}}.api.ccalp.dev", "AngularUrl": "https://{{tenantName}}.ccalp.dev", "CorsOrigins": "https://*.ccalp.dev,https://ccalp.dev,https://app-compucare-api-dev.azurewebsites.net", "RedirectAllowedUrls": "https://*.ccalp.dev,https://ccalp.dev,https://app-compucare-api--ev.azurewebsites.net,https://{{tenantName}}.ccalp.dev/", "HealthCheckUrl": "https://api.ccalp.dev/health-status" },
private void ConfigureUrls(IConfiguration configuration)
{
Configure<AppUrlOptions>(options =>
{
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
options.Applications["Angular"].RootUrl = configuration["App:AngularUrl"];
options.Applications["Angular"].Urls[AccountUrlNames.PasswordReset] = "account/reset-password";
options.Applications["Angular"].Urls[AccountUrlNames.EmailConfirmation] = "account/email-confirmation";
options.RedirectAllowedUrls.AddRange(configuration["App:RedirectAllowedUrls"].Split(','));
});
}
This is what I have in my appsettings, should I add that one too?
"App": { "SelfUrl": "https://{{tenantName}}.api.ccalp.net", "AngularUrl": "https://{{tenantName}}.ccalp.net", "CorsOrigins": "https://.ccalp.net,https://ccalp.net,https://app-compucare-api.azurewebsites.net", "RedirectAllowedUrls": "https://*.ccalp.net,https://ccalp.net,https://app-compucare-api.azurewebsites.net", "DisablePII": "false", "HealthCheckUrl": "https://api.ccalp.net/health-status" },