Open Closed

First Post and need help with commercial modules #4825


User avatar
0
Navneet@aol.com.au created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v7.0.3
  • UI type: Angular / MVC / Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hello support team and other ABP users,

I have tried my level best to first search below issues but could not find solutions, I am a new developer so if any question is silly then sorry

Could you please help me with below:

  1. After I create a new Module via ABP Suite with UI, the Suite create all necessary CRUD pages, model, DTO and repositories, however when I change anything manually, for example N-2-N relationship it creates only one side of UI and I manually create another side, the suite change the code back to default if I re-run the same entity generation. I believe I can get around by creating partial class, but as suite create a lot of classes in domain, efcore, application, applicationcontracts... I end up some errors with referring partial classes in repositories. IS it ok if you can provide a sample of book entity created via suite and using partial class. I believe that will be helpful for other community member looking for similar solution.

  2. When I create a new application via suite and add Volo.Docs and Volo.Payment via suite, they are not part of Feature under Editions settings, but both are available under Role --> Permissions, can you please help me, how can I add them to Edition --> Features (can you please suggest any code I can override related class instead of changing source code, as I don’t have access to source code dueto my license)

  3. Regarding ABP.Volo.Payment, why tenant has permission to create plan or update plan by default. I am just trying to understand what is the logic to allow tenant to change plans created by host. Is it to allow my tenants to set their own payment Payment Gateway so my tenant can issue their own invoice and received payment from their customers, like B2B2C

  4. As I don’t have access to all commercial sourcecode due to license level, how can I override to make changes to base class, please code sample of only three, rest of classes I will figureout Replace OpenIddictApplication.cs with myOpenIddictApplication.cs Replace OpenIddictDbContextModelCreatingExtensions.cs with myOpenIddictDbContextModelCreatingExtensions.cs last, I want to replace AbpOpenIddictProPermissionDefinitionProvider.cs with my myAbpOpenIddictProPermissionDefinitionProvider

  5. When I publish my project, I noticed that appsettings.secrets.json is also in published folder, is it safe to give it to my client while hand overing the finished Application

  6. When I create a MVC Application with public page & CMS (identity & HostApi not separate), the public page does not use API but use database directly, how can I make it use API instead of interacting with DB directly (please note, I don’t want to have separate Identity & HostApi)

  7. MVC public page, in responsive mode, I don’t see login button, it’s hidden, can you please help me, how can I fix it? Screenshot attached:

Is there anyplace like GitHub, can I read Commercial Module change log for example - CRMpro module changes from 7.0.1 to 7.0.3, this will help me to plan before migrating to next version.

Please let me know if anything not clear and I will try to give more details Regards, Navneet


57 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Please try:

    https://github.com/NavneetProject/abp-commercial-docs/tree/{version}

  • User Avatar
    0
    Navneet@aol.com.au created

    Please try:

    https://github.com/NavneetProject/abp-commercial-docs/tree/{version}

    . . Hi Liangshiwei, I have tried exactly, but didn't work, I have send you GitHub token and Github User Agent by email

  • User Avatar
    0
    Navneet@aol.com.au created

    screenshot below

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Should be:

    https://github.com/NavneetProject/abp-commercial-docs/tree/{version}

    Not https://github.com/NavneetProject/abp-commercial-docs/tree/1.0.0

  • User Avatar
    0
    Navneet@aol.com.au created

    Hi,

    Should be:

    https://github.com/NavneetProject/abp-commercial-docs/tree/{version}

    Not https://github.com/NavneetProject/abp-commercial-docs/tree/1.0.0 .

    . . Many thanks, it was easy fix. . .


    . .

    4

    Replace OpenIddictApplication.cs with myOpenIddictApplication.cs Replace OpenIddictDbContextModelCreatingExtensions.cs with myOpenIddictDbContextModelCreatingExtensions.cs

    You can't replace the OpenIddictApplication entity with your own. you can consider using the object extensions system: https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities

    . .

    In regards to point number number 4, if you need details info, I can send you by email due to client confidential codes. However, summary is below:

    As ABP Commercial has OpenID module to add application via UI, my client is looking to add new application & assign Users or Roles to the application so that my client can control the access to application.

    How can I achieve without replacing OpenID module code as I my license don't allow to download source code?

    Regards, Navneet

  • User Avatar
    0
    Navneet@aol.com.au created

    Hi liangshiwei,

    Any update on how to achieve on point number 4

    Regards, Navneet

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry for late.

    Why not create your own UI to assign Users or Roles to the application?

    You only need to use the object extensions system to add new properties to the entity. See https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities#entity-extensions-ef-core You can use the EF Core API to create foreign keys or other configurations.

  • User Avatar
    0
    Navneet@aol.com.au created

    Hi liangshiwei,

    That I have done it, but how to intercept in middleware to allow or restrict the access

    Regards Navneet

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can use the ASPNET Core standard middleware to do it, it's not related to ABP : https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-7.0

  • User Avatar
    0
    Navneet@aol.com.au created

    Hi,

    You can use the ASPNET Core standard middleware to do it, it's not related to ABP : https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-7.0

    Hi liangshiwei,

    Sorry, maybe I wasn't clear, how can i configure Application to allow certain users only

    Regards, Navneet

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can use the authorization system: https://docs.abp.io/en/abp/latest/Authorization

  • User Avatar
    0
    Navneet@aol.com.au created

    Many thx,

    Let me give a try and will come back to you

  • User Avatar
    0
    Navneet@aol.com.au created

    Hi liangshiwei,

    So far I manage to build below but there are some issues I am facing:

    a) in below is not resolving error: The type or namespace name 'IdentityUser' could not be found (are you missing a using directive or an assembly reference?) [Acme.BookStore.Domain.Shared]

    private static void ConfigureExtraProperties()
        {
            OneTimeRunner.Run(() =>
        {
            ObjectExtensionManager.Instance.Modules()
                .ConfigureOpenIddict(openIddictApplication =>
                {
                    openIddictApplication.ConfigureApplication(application =>
                    {
                        application.AddOrUpdateProperty<IdentityUser>( //property type: IdentityUser
                            "AppUser", //property name
                            property =>
                            {
                                property.UI.Lookup.Url = "/api/identity/users";
                                property.UI.Lookup.DisplayPropertyName = "userName";
                            }
                        );
                    });
                });
        });
    

    b) Do you think below code is sufficient to create a dedicated column in database

    ObjectExtensionManager.Instance
                .MapEfCoreProperty<OpenIddictApplication, IdentityUser>(
                    "AppUser"
                );
    

    c) Most time was taken to read  https://docs.abp.io/en/abp/latest/Authorization, but it was worth reading :-). what I understand is Permission like CRUD can be design but that is for Entity level, however I need to define permission for each application created in Volo.Abp.OpenIddict.OpenIddictApplication Individual Application created in OpenIddictApplication

    Regards, Navneet

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    We have an example of how to custom Identityuser: https://github.com/abpframework/abp-samples/tree/master/DocumentationSamples/CustomApplicationModules

    Most time was taken to read https://docs.abp.io/en/abp/latest/Authorization, but it was worth reading :-). what I understand is Permission like CRUD can be design but that is for Entity level, however I need to define permission for each application created in Volo.Abp.OpenIddict.OpenIddictApplication Individual Application created in OpenIddictApplication

    You can grant permissions to OpenIddictApplication.

  • User Avatar
    0
    Navneet@aol.com.au created

    Thanks liangshiwei,

    I have already considered your method, but the issue is:- my client want to assign users or roles to individual Application. The method you have suggested allow users to access all applications in OpenIddictApplication.

    My undressing is if I add a new N-2-N property "AppUser" in OpenIddictApplication, then each application created in OpenIddictApplication, I can select individual user, the trouble is I am getting below error at AddOrUpdateProperty<IdentityUser>

    The type or namespace name 'IdentityUser' could not be found (are you missing a using directive or an assembly reference?) [Acme.BookStore.Domain.Shared]

    private static void ConfigureExtraProperties()
        {
            OneTimeRunner.Run(() =>
        {
            ObjectExtensionManager.Instance.Modules()
                .ConfigureOpenIddict(openIddictApplication =>
                {
                    openIddictApplication.ConfigureApplication(application =>
                    {
                        application.AddOrUpdateProperty<IdentityUser>( //property type: IdentityUser
                            "AppUser", //property name
                            property =>
                            {
                                property.UI.Lookup.Url = "/api/identity/users";
                                property.UI.Lookup.DisplayPropertyName = "userName";
                            }
                        );
                    });
                });
        });
    

    . . If you believe that above is not the right way, then please suggest how can I achieve it? . . Regards, Navneet

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    The type or namespace name 'IdentityUser' could not be found (are you missing a using directive or an assembly reference?)

    You should add the namespace using: Volo.Abp.Identity.

    The full namespace is Volo.Abp.Identity.IdentityUser

  • User Avatar
    0
    Navneet@aol.com.au created

    Hi Liangshiwei,

    I tried full namespace, but still getting error that missing assembly:

    application.AddOrUpdateProperty<Volo.Abp.Identity.IdentityUser>
    

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Can you use a minimum project to reproduce the problem and share it with me? shiwei.liang@volosoft.com I will check it

  • User Avatar
    0
    Navneet@aol.com.au created

    Can you use a minimum project to reproduce the problem and share it with me? shiwei.liang@volosoft.com I will check it

    I have sent you the project by email

    Regards, Navneet

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can't add navigation properties this way.

    Consider:

     ObjectExtensionManager.Instance
        .MapEfCoreProperty<OpenIddictApplication, Guid?>(
            "AppUserId"            
        );
        
    ObjectExtensionManager.Instance.Modules()
        .ConfigureOpenIddict(openIddictApplication =>
        {
            openIddictApplication.ConfigureApplication(application =>
            {
                application.AddOrUpdateProperty<Guid?>( //property type: IdentityUser
                    "AppUserId", //property name
                    property =>
                    {
                        property.UI.Lookup.Url = "/api/identity/users";
                        property.UI.Lookup.DisplayPropertyName = "userName";
                        property.UI.Lookup.ValuePropertyName = "id";
                    }
                );
            });
        });
    

    I have modified the project you shared and sent it to you via email.

    You will find the UI source code of openiddict module in the project, here are some issues from ABP, we will fix it

  • User Avatar
    0
    Navneet@aol.com.au created

    Many thanks liangshiwei,

    The code you have suggested doesn't work in my case.

    1. I need to allocated multiple users to the application, that's why I was trying to application.AddOrUpdateProperty<IdentityUsers>

    2. I need to set permission in a way so that only selected users can access

    Regards, Navneet

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I need to allocated multiple users to the application, that's why I was trying to application.AddOrUpdateProperty<IdentityUsers>

    As I said: You can't add navigation properties this way., so it's not possible.

    But you add the UserId, I think this is enough, you can get the user by id.

    I need to set permission in a way so that only selected users can access

    I don't know what's your case details, can you explain it in detail? I will try to help you.

  • User Avatar
    0
    Navneet@aol.com.au created

    Sure, I will try to explain:-

    My client has 20 users, and 4 Applications created via UI.

    He don't want all users to access all 4 Application. He wants to assign users to application so that only allowed users can access.

    In Nutshell, my client is looking a relation between Users and Application a N-2-N relationship.

    Regards, Navneet

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Ok, well, I think you're overcomplicating things, you don't even need to extend the entity.

    Just using the ABP Suite to create an intermediate table :

    implement the IOpenIddictProDbContext

    Replace the IApplicationAppService service:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IApplicationAppService))]
    public class MyApplicationAppService : ApplicationAppService
    {
        private readonly IRepository<OpenIddictUser, Guid> _openIddictUserRepository;
    
        public MyApplicationAppService(
            IOpenIddictApplicationManager applicationManager,
            IOpenIddictApplicationRepository applicationRepository,
            IOpenIddictUserRepository openIddictUserRepository) : base(
            applicationManager, applicationRepository)
        {
            _openIddictUserRepository = openIddictUserRepository;
        }
    
        public override async Task<PagedResultDto<ApplicationDto>> GetListAsync(GetApplicationListInput input)
        {
            var list = await base.GetListAsync(input);
            var resultList = new List<ApplicationDto>();
            foreach (var item in list.Items)
            {
                if (await _openIddictUserRepository.AnyAsync(x => x.UserId == CurrentUser.Id && x.OpenIddictApplicationId == item.Id))
                {
                    resultList.Add(item);
                }
            }
    
            return new PagedResultDto<ApplicationDto>(resultList.Count, resultList);
        }
    }
    

    Add automapper config

    CreateMap<OpenIddictApplication, ApplicationDto>()
        .ForMember(des=>des.Scopes,src =>src.Ignore())
        .ForMember(des=>des.PostLogoutRedirectUris,src =>src.Ignore())
        .ForMember(des=>des.RedirectUris,src =>src.Ignore());
    

  • User Avatar
    0
    Navneet@aol.com.au created

    WOW you just blew my mind :-)

    If you still have that project you created, could you please share with me by email.

    Also, Instead of using my MainApp to create your suggested navigation, do you think, I can create in a ABP custom Module for above custom changes, then use it as plugin Module.

    Request: Could you please explain how exactly your suggested code works?

    Many thanks, Regards, Navneet

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35