Activities of "selinkoykiran"

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:

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, 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, 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 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 .

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

Hello, I've read Changing Features Definitions of a Depended Module header in this link : https://docs.abp.io/en/abp/latest/Features . But I want to move this existing file management feature into another application depended custom group and then customize it. How can we do that ? By the way I also tried remove existing file management feature group option and then changed it in my own custom feature group but it acted weird , it didn't get default values and did not work.

Thank you

Hello, I implemented like you said but id property is same for all the checkboxes in html so checkboxes not working right now : You can see the error below, how could we give different Id's ?

Thank you

Hello, We use FileManagement module in our project and when try to download we got error like below from RemoteStreamContent. We override the appService layer because of some needs like below :

        public async override Task<RemoteStreamContent> DownloadAsync(Guid id)
        {
            var file = await FileDescriptorRepository.GetAsync(id);
            if (file.DirectoryId == null)
            {
                throw new Exception("Directory can not be empty");
            }
            _blobContainer = _blobProviderSelector.Get((Guid)file.DirectoryId);
            var stream = await _blobContainer.GetAsync(id.ToString());
            return new RemoteStreamContent(stream);
        }

We've just changed blobContainer part the remaining part is same with 4.2.2 FileDescriptorAppService code. We tried in json type or the other file types but we think there is some issue about response header maybe ? Could you please help ? Thank you

  • ABP Framework version: v4.2.2
  • UI type:MVC
  • DB provider: EF Core
  • **Tiered (MVC) : yes
  • Exception message and stack trace:
*2021-03-24 17:25:04.140 +03:00 [ERR] Each parameter in constructor 'Void .ctor(System.IO.Stream)' on type 'Volo.Abp.Content.RemoteStreamContent' must bind to an object property or field on deserialization. Each parameter name must match with a property or field on the object. The match can be case-insensitive.
System.InvalidOperationException: Each parameter in constructor 'Void .ctor(System.IO.Stream)' on type 'Volo.Abp.Content.RemoteStreamContent' must bind to an object property or field on deserialization. Each parameter name must match with a property or field on the object. The match can be case-insensitive.
  at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(ConstructorInfo constructorInfo, Type parentType)
  at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
  at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
  at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
  at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
  at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, Type returnType, JsonSerializerOptions options)
  at Volo.Abp.Json.SystemTextJson.AbpSystemTextJsonSerializerProvider.Deserialize[T](String jsonString, Boolean camelCase)
  at Volo.Abp.Json.AbpHybridJsonSerializer.Deserialize[T](String jsonString, Boolean camelCase)
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.MakeRequestAndGetResultAsync[T](IAbpMethodInvocation invocation)
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.GetResultAsync(Task task, Type resultType)
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.InterceptAsync(IAbpMethodInvocation invocation)
  at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
  at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
  at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
  at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
  at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
  at Volo.FileManagement.Files.FileDescriptorController.DownloadAsync(Guid id)
  at lambda_method1814(Closure , Object )
  at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  • Steps to reproduce the issue:

Hello, I sent a sample project .

Thank you.

hello, So then this is a bug in FileManagement Module , right ? Will you fix it in next versions ? Because we don't want to add module directly into our project because of maintenance issues depends on version changing. I'll try anyway your answer with overriding these files in my project.

Thank you.

Showing 1 to 10 of 75 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11