Activities of "liangshiwei"

Hi,

You can try this:

  • Add Volo.Abp.Identity.Pro.Domain to your Domain project
  • Add Volo.Abp.Identity.Pro.EntityFrameworkCore to your EntityFrameworkCore project
  • Add module dependencies to your module

Domain

public class AgencyUser : FullAuditedAggregateRoot<Guid>
{
    public Guid IdentityUserId { get; set; }
    public IdentityUser IdentityUser { get; set; }

    public Guid AgencyId { get; set; }
    public Agency Agency { get; set; }
}
 
public class Agency : Entity<Guid>
{
    public string Name { get; set; }
}

EntityFrameworkCore

public class AgencyUserMap : IEntityTypeConfiguration<AgencyUser>
{
    public void Configure(EntityTypeBuilder<AgencyUser> builder)
    {
        builder.ConfigureByConvention();

        builder.ToTable("AgencyUser");

        builder.HasKey(x => x.Id);

        builder.Property(x => x.Id).ValueGeneratedOnAdd();

        builder.HasOne<IdentityUser>().WithMany().HasForeignKey(x => x.IdentityUserId);
        builder.HasOne<Agency>().WithMany().HasForeignKey(x => x.AgencyId);

        builder.Navigation(x => x.IdentityUser).AutoInclude();
        builder.Navigation(x => x.Agency).AutoInclude();
        builder.ApplyObjectExtensionMappings();
    }
}
builder.ApplyConfiguration(new AgencyUserMap());

builder.Entity<Agency>(b =>
{
    b.ToTable("Agency");
    b.ApplyObjectExtensionMappings();
});
[ReplaceDbContext(typeof(IIdentityProDbContext))]
[ConnectionStringName(MyServiceDbProperties.ConnectionStringName)]
public class MyServiceDbContext : AbpDbContext<MyServiceDbContext> ,  IIdentityProDbContext
{
    // Identity
    public DbSet<IdentityUser> Users { get; set; }
    public DbSet<IdentityRole> Roles { get; set; }
    public DbSet<IdentityClaimType> ClaimTypes { get; set; }
    public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
    public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
    public DbSet<IdentityLinkUser> LinkUsers { get; set; }
    
    
    public DbSet<AgencyUser> AgencyUsers { get; set; }
    public DbSet<Agency> Agencies { get; set; }

    public MyServiceDbContext(DbContextOptions<MyServiceDbContext> options)
        : base(options)
    {

    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        builder.ConfigureIdentityPro();
        builder.ConfigureMyService();
    }
}

Hi,

Add reference to package: Volo.Abp.IdentityServer.Domain to EntityFrameworkCore and Domain projects

I remember that ABP app pro startup template already preinstalled those modules, are you using a module template?

Hi,

You can check if the NET Core Runtime is installed on your server. https://learn.microsoft.com/en-us/dotnet/core/install/linux

Hi,

We will check it.

Hi,

Try removing Response.StatusCode = 403;

This is my code:

public ModelError Error { get; set; }

public class ModelError
{
    public string Message { get; set; }
}

public virtual async Task<IActionResult> OnGetAsync()
{
    try
    {
        throw new UserFriendlyException("A test message");
        UserInfo = new UserInfoViewModel();

        var roleDtoList = (await IdentityUserAppService.GetAssignableRolesAsync()).Items;

        Roles = ObjectMapper.Map<IReadOnlyList<IdentityRoleDto>, AssignedRoleViewModel[]>(roleDtoList);

        foreach (var role in Roles)
        {
            role.IsAssigned = role.IsDefault;
        }
    }
    catch (Exception e)
    {
        Error = new ModelError { Message = e.Message };
    }
    

    return Page();
}
<form method="post" asp-page="/Identity/Users/CreateModal">
    <abp-modal>
        <abp-modal-header title="@L["NewUser"].Value"></abp-modal-header>
        <abp-modal-body>
            @if (Model.Error != null)
            {
                <span>@Model.Error.Message</span>
            }
            else
            {
               .....
            }
            
    .......

Hi,

Can you share the full steps? thanks.

Hi,

Here is a sample you can check https://github.com/abpframework/abp/tree/dev/modules/blogging/app/Volo.BloggingTestApp.MongoDB

Hi,

System.Collections.Specialized is part of NET core runtime.

Can you try this?

dotnet publish -c release --os linux --self-contained

Hi,

You can add a custom message handler

public override void PreConfigureServices(ServiceConfigurationContext context)
{
    PreConfigure<AbpHttpClientBuilderOptions>(options =>
    {
        options.ProxyClientBuildActions.Add((s, builder) =>
        {
            builder.AddHttpMessageHandler<MyMessageHandler>();
        });
    });
}

public class MyMessageHandler : DelegatingHandler, ITransientDependency
{
    protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    {
        request.Headers.Add(....);
        return base.SendAsync(request, cancellationToken);
    }
}

menus folder with the menucontributor and i followed your instructions, only permission work but it didn't appear any button or link in the menu. So if I want to apply permission on a button or link that already exists, what's the best way to do this? E.g. I want to apply a permission on the "My account" button (see the picture below)

Here I have explained how to hide link account, to hide my account we just have to do something like this: https://support.abp.io/QA/Questions/3741#answer-d4e39d0b-e9fe-2225-d96c-3a067a5828eb

public class MyProjectNameMenuContributor : IMenuContributor
{
    public async Task ConfigureMenuAsync(MenuConfigurationContext context)
    {
        //......
        if (context.Menu.Name == StandardMenus.User)
        {
            var linkedAccount = context.Menu.GetMenuItemOrNull("Account.Manage");
            linkedAccount?.RequirePermissions("<Your permission name>");
        }
    }
}

It still does not work for you, you can share the project with me via email, I will check it, shiwei.liang@volosoft.com

Showing 421 to 430 of 2428 entries
Made with ❤️ on ABP v9.2.0-preview. Updated on January 24, 2025, 10:25