hi,
Volo.Abp.AspNetCore.Mvc.UI.Theme.Commercial
package has been removed from the Lepton solution.
This is an almost empty project. Why do you need this library?
I can share you the project https://gist.github.com/ebicoglu/a486b5f81e11bd32045bb712f3d65ab4
good to know ;)
you can add extra property to the current Tenant
object.
Open YourProjectModuleExtensionConfigurator.cs
and replace the ConfigureExtraProperties()
method with below:
private static void ConfigureExtraProperties()
{
OneTimeRunner.Run(() =>
{
ObjectExtensionManager.Instance.Modules()
.ConfigureSaas(x =>
{
x.ConfigureTenant(tenant =>
{
tenant.AddOrUpdateProperty<string>(
"MyExtraProperty",
property =>
{
//validation rules
property.Attributes.Add(new RequiredAttribute());
property.Attributes.Add(
new StringLengthAttribute(64)
{
MinimumLength = 4
}
);
//...other configurations for this property
}
);
});
});
});
}
Ref: https://docs.abp.io/en/abp/latest/Module-Entity-Extensions
check that your issuer is configured as: issuer: 'https://localhost:44313',
in environment.prod.ts
also be aware that these are local addresses. when you deploy it to prod, you need to set it to your real domain names.
I think if you redraw the datatables fnRowCallback
will be executed and it renders rowActions
https://github.com/abpframework/abp/blob/1ccf95f161372353e2ee6027d983739e6b9fb12b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js#L270
You can override the IdentityUserAppService
's Create
method to run your business logic before the built-in create method runs.
See Overriding-Services document to understand how you can override the Create
method.
I tried to imlement this and it works.
Put the below class in your *.Application
project.
MyIdentityUserAppService.cs
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.Validation;
using System;
using System.Linq;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Saas.Editions;
using Volo.Saas.Tenants;
namespace AbpCommercialTest
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IIdentityUserAppService), typeof(IdentityUserAppService), typeof(MyIdentityUserAppService))]
public class MyIdentityUserAppService : IdentityUserAppService
{
private readonly ITenantRepository _tenantRepository;
private readonly IEditionRepository _editionRepository;
private readonly IIdentityUserRepository _userRepository;
public MyIdentityUserAppService(
IdentityUserManager userManager,
IIdentityUserRepository userRepository,
IIdentityRoleRepository roleRepository,
IOrganizationUnitRepository organizationUnitRepository,
IIdentityClaimTypeRepository identityClaimTypeRepository,
IdentityTwoFactorManager identityTwoFactorManager,
IOptions<IdentityOptions> identityOptions,
ITenantRepository tenantRepository,
IEditionRepository editionRepository) : base(userManager,
userRepository,
roleRepository,
organizationUnitRepository,
identityClaimTypeRepository,
identityTwoFactorManager,
identityOptions
)
{
_userRepository = userRepository;
_tenantRepository = tenantRepository;
_editionRepository = editionRepository;
}
public override async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
{
if (CurrentTenant.Id.HasValue) //check that it's tenant
{
var currentTenant = await _tenantRepository.GetAsync(CurrentTenant.Id.Value); //get tenant
if (!currentTenant.EditionId.HasValue)
{
throw new BusinessException("You don't have an edition!");
}
var usersCount = await _userRepository.GetCountAsync(); //get current user count of the tenant
var editionOfTenant = await _editionRepository.GetAsync(currentTenant.EditionId.Value);
editionOfTenant.ExtraProperties["MaxUserCount"] = 5; //temporary code for testing.
if (long.Parse(editionOfTenant.ExtraProperties["MaxUserCount"].ToString() ?? "0") > usersCount)
{
throw new UserFriendlyException("You do not have the right to create a new user!");
}
}
return await base.CreateAsync(input); //let the the built-in create method continue...
}
}
}
Note that I've used the extra properties of the edition. There are various ways to do this. Feaures or adding a new field to Tenant entitiy. Or creating a new entity etc...
Yeah this is a feature that exists in ASP.NET Zero. Be aware that the template comes with a few entities comparing the ones you will create. The main user data will be your business data and we need to figure out how to integrate your custom entity to be included in this schedule.
I reported this as a feature request under our internal repo with #5345
Ok. I created an issue for this. But adding description to the EntityDto is unnecessary and data duplication.
I guess you hit this issue https://github.com/dotnet/runtime/issues/1720
if you send us your customized classes we'll try to reproduce