Is there any posibility that we can add attribute which prevents serialization of property ? How can i remove attribute from property ?
public static class NMMApplicationContractsExtensionConfigurator
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
OneTimeRunner.Run(() =>
{
ConfigureProperties();
});
}
private static void ConfigureProperties()
{
ObjectExtensionManager.Instance.AddOrUpdateProperty<SaasTenantCreateDto, string>("AdminEmailAddress",
options =>
{
options.Attributes.Add(new System.Text.Json.Serialization.JsonIgnoreAttribute());
options.Attributes.Remove(new StringLengthAttribute(256));
options.Attributes.Add(new StringLengthAttribute(3)
{
MinimumLength = 1
}
);
});
}
}
Definition done at PreConfigure step
public override void PreConfigureServices(ServiceConfigurationContext context)
{
NMMApplicationContractsExtensionConfigurator.Configure();
}
However, still able to pass validation, that means i couldn't change DTO properties
https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services
Hello, I want to override the method in the application service which in a seperate module.
using Volo.Saas.Editions;
using Volo.Saas.Host.Dtos;
using Volo.Saas.Tenants;
namespace Volo.Saas.Host
{
[Authorize(SaasHostPermissions.Tenants.Default)]
public class TenantAppService : SaasHostAppServiceBase, ITenantAppService
{
public TenantAppService(.........
)
[Authorize(SaasHostPermissions.Tenants.Create)]
public virtual async Task<SaasTenantDto> CreateAsync(SaasTenantCreateDto input)
{
}
}
}
I'm just targeting to override CreateAsync in my solution
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(ITenantAppService), typeof(TenantAppService), typeof(NMMTenantAppService))]
public class NMMTenantAppService : TenantAppService
{
public NMMTenantAppService(
IEditionRepository editionRepository,
ITenantRepository tenantRepository,
ITenantManager tenantManager,
IDataSeeder dataSeeder)
: base(
tenantRepository: tenantRepository,
editionRepository: editionRepository,
tenantManager: tenantManager,
dataSeeder: dataSeeder)
{
}
public async override Task<SaasTenantDto> CreateAsync(SaasTenantCreateDto input)
{
var tenant = await TenantManager.CreateAsync(input.Name, input.EditionId);
input.MapExtraPropertiesTo(tenant);
await TenantRepository.InsertAsync(tenant);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<Tenant, SaasTenantDto>(tenant);
}
}
Beside that I'm also not happy with** SaasTenantCreateDto**. Tricky part is I don't want to extend DTO, I want to remove properties What is the recommended way to do this in framework ?
Do I need create a new ApplicationService in my project with new interface ? And replace service from module with a new one
App Service
[Authorize(SaasHostPermissions.Tenants.Default)]
public class NMMTenantAppService : SaasHostAppServiceBase, INMMTenantAppService
{
}
Method
[Authorize(SaasHostPermissions.Tenants.Create)]
public async Task<SaasTenantDto> CreateAsync(**NMMSaasTenantCreateDto** input)
{
}
Interface
public interface INMMTenantAppService : ICrudAppService<SaasTenantDto, Guid, GetTenantsInput, **NMMSaasTenantCreateDto**, SaasTenantUpdateDto>
{
}
Dto
public class NMMSaasTenantCreateDto : SaasTenantCreateOrUpdateDtoBase
{
}
Thx, Missed one of the underscore,
HeaderTenantResolveContributor: Tries to find current tenant id from HTTP headers. The header name is __tenant by default.
Hi, I have created a separate database for each tenant in order to provide data isolation between host and tenant in my system. Migration operation is performed over different contextes
Host is
/* Include modules to your migration db context */
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureIdentity();
builder.ConfigureIdentityServer();
builder.ConfigureFeatureManagement();
builder.ConfigureLanguageManagement();
builder.ConfigureSaas();
builder.ConfigureTextTemplateManagement();
builder.ConfigureBlobStoring();
/* Custom platform modules */
builder.ConfigureCredit();
/* Configure your own tables/entities inside the ConfigureNMM method */
builder.ConfigureNMM();
Tenat is
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureAuditLogging();
builder.ConfigureIdentity();
builder.ConfigureFeatureManagement();
builder.ConfigureLanguageManagement();
builder.ConfigureTextTemplateManagement();
As you can see from above we didn't create any identityServer4 related table at tenant side since it is host related task
As far as i can see out of box app client supports password grant flow
CreateClientAsync(
name: consoleAndAngularClientId,
scopes: commonScopes,
grantTypes: new[] { "password", "client_credentials", "authorization_code" },
secret: (configurationSection["XYZ_App:ClientSecret"] ?? "1q2w3e*").Sha256(),
requireClientSecret: ~~false~~ true,
redirectUri: webClientRootUrl,
postLogoutRedirectUri: webClientRootUrl,
~~corsOrigins: new[] { webClientRootUrl.RemovePostFix("/") ~~
Ofcourse, there is no problem for the host users
However tenant users are not able get token for the API calls, Any hint ?