Activities of "selinkoykiran"

Hello again , we found the solution I want to share : Actually there is already a warning which we ignored "Inherit your controllers from this class" : We basically write methods into this base controller so we couldn't see in swagger.

 /* **Inherit your controllers from this class.**
     */
    public abstract class EasyCrmController : AbpController
    {
        protected EasyCrmController()
        {
            LocalizationResource = typeof(EasyCrmResource);
        }
    }

But when inherit from this controller class like below and create another controller, issue resolved automatically.

  [Route("api/test")]
    public class TestController : EasyCrmController
    {
        [HttpGet]
        [Route("")]
        public Task<List<TestModel>> GetAsync()
        {
            return Task.FromResult(new List<TestModel>
            {
                new TestModel {Name = "John", BirthDate = new DateTime(1942, 11, 18)},
                new TestModel {Name = "Adams", BirthDate = new DateTime(1997, 05, 24)}
            });
        }
    }

Solution is ok but why do we need to inherit from base controller to see methods in swagger ? Is is about dependency injection in HttpApiHost application or something else ? Could you explain the reason ?

Thank you .

Hello, We have a module with HttpApi.Host in it. When add some methods into module's HttpApi library's default controller , we couldn't see these methods in httpApi.Host swagger. We checked all implementations which needs to be done but we couldn't figure out the problem. We checked HttpApiModule and HttpApiHostModule implementations, the other modules integration and their methods are shown in swagger but in own module controller methods can't seen. What do you think we missed ?

Thank you .

  • ABP Framework version: v.4.1.2
  • UI type:MVC
  • DB provider: EF Core
  • **Tiered (MVC) : yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hello, We used multitenancy with database per tenant approach and then created host and tenant db's with dbMigrator it works well. But we realized something. When tenant db is creating it also creates Identity server based tables ,too. But we don't use identityserver based tables on tenant db side besides we can't see any identity server settings part on UI side which we think it makes sense. But when db migrator create databases for both host and tenants they use same dbcontext so we couldn't prevent creation of IdentityServer depended tables in tenant databases. How could we achieve that with abp ? Is there any solution for this db context issue or we need to handle it on our own system like creating seperate db context for tenants or something?

Thank you.

  • ABP Framework version: v4.1.2
  • UI type: MVC
  • DB provider: EF Core
  • **Tiered (MVC) : yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hello, In my domain module I add CustomIdentityDataSeeder and CustomIdentityDataSeedContributor classes like below. In the note section we described the situation. Because of dependency injection issues maybe this class hits 2 times . At first time admin email comes with admin@abp.io email second time I could use my custom email . But how does it admin@abp.io default email hit at the first time. How could I prevent it because I think I've already overriden these classes . I don't want to check like if blocks.

Thank you

CustomIdentityDataSeedContributor

using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.Identity;
namespace Custom.XXX.Identity
{
    public class CustomIdentityDataSeedContributor :  IdentityDataSeedContributor
    {
        protected CustomIdentityDataSeeder CustomIdentityDataSeeder { get; }

        public CustomIdentityDataSeedContributor(CustomIdentityDataSeeder identityDataSeeder) 
            : base(identityDataSeeder)
        {
            CustomIdentityDataSeeder = identityDataSeeder;
        }

        public override Task SeedAsync(DataSeedContext context)
        {
            return CustomIdentityDataSeeder.SeedAsync(
               "custom@Custom.com",
               "Pass1234+",
               context?.TenantId
           );

        }
    }
}

CustomIdentityDataSeeder

using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Guids;
using Volo.Abp.Identity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Uow;
using IdentityRole = Volo.Abp.Identity.IdentityRole;
using IdentityUser = Volo.Abp.Identity.IdentityUser;

namespace Custom.XXX.Identity
{
    public class CustomIdentityDataSeeder : IdentityDataSeeder
    {
        public CustomIdentityDataSeeder(IGuidGenerator guidGenerator,
            IIdentityRoleRepository roleRepository,
            IIdentityUserRepository userRepository,
            ILookupNormalizer lookupNormalizer,
            IdentityUserManager userManager,
            IdentityRoleManager roleManager,
            ICurrentTenant currentTenant,
            IOptions<IdentityOptions> identityOptions)
            : base(guidGenerator, roleRepository, userRepository, lookupNormalizer, userManager, roleManager, currentTenant, identityOptions)
        {
        }

        [UnitOfWork]
        public override async Task<IdentityDataSeedResult> SeedAsync(string adminEmail, string adminPassword, Guid? tenantId = null)
        {
            var result = new IdentityDataSeedResult();
            Check.NotNullOrWhiteSpace(adminEmail, nameof(adminEmail));
            Check.NotNullOrWhiteSpace(adminPassword, nameof(adminPassword));
            string adminUserName = "custom";
		**	//NOTE  we dont want to check like below for abp.io user 
            if (adminEmail == "admin@abp.io")
            {
                return result;
            }**
            if (tenantId!= Guid.Empty && tenantId != null)
            {
                adminUserName = "custom2";
                if(adminEmail == "custom@Custom.com")
                {
                    adminEmail = "custom2@Custom.com";
                }
            }

            using (CurrentTenant.Change(tenantId))
            {
                //"admin" user
               
                var adminUser = await UserRepository.FindByNormalizedUserNameAsync(
                    LookupNormalizer.NormalizeName(adminUserName)
                );

                if (adminUser != null)
                {
                    return result;
                }

                adminUser = new IdentityUser(
                    GuidGenerator.Create(),
                    adminUserName,
                    adminEmail,
                    tenantId
                )
                {
                    Name = adminUserName
                };

                (await UserManager.CreateAsync(adminUser, adminPassword)).CheckErrors();
                result.CreatedAdminUser = true;

                //"admin" role
                const string adminRoleName = "admin";
                var adminRole = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(adminRoleName));
                if (adminRole == null)
                {
                    adminRole = new IdentityRole(
                        GuidGenerator.Create(),
                        adminRoleName,
                        tenantId
                    )
                    {
                        IsStatic = true,
                        IsPublic = true
                    };

                    (await RoleManager.CreateAsync(adminRole)).CheckErrors();
                    result.CreatedAdminRole = true;
                }

                (await UserManager.AddToRoleAsync(adminUser, adminRoleName)).CheckErrors();

                return result;
            }
        }
    }
}

Hello, To prevent inserting abp default admin user we override IdentityDataSeeder and IdentityDataSeedContributor Seed methods. But IdentityDataSeeder method called 2 times in debug mode . At first time method came with admin@abp.io email information and second time our overridden admin definition inserted. But we don't want to add abp default admin user when seeding. What do we need to do ? We made if else for now but we don't want to use like below. Thank you .

  • ABP Framework version: v4.1.2
  • UI type: MVC
  • DB provider: EF Core
  • **Tiered (MVC): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:
Showing 71 to 75 of 75 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11