Activities of "hayash"

hi team i want to change textbox in TenantSwitchModal to dropdowm list but i don't have source code of Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy i used it as package reference

Regards.

ok, i user Volo.Abp.Identity.Domain as a project reference to Volo.Abp.Account.HttpApi and in AbpIdentityDomainModule here the code

public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddAutoMapperObjectMapper<AbpIdentityDomainModule>();

    Configure&lt;AbpAutoMapperOptions&gt;(options =>
    {
        options.AddProfile&lt;IdentityDomainMappingProfile&gt;(validate: true);
    });

    Configure&lt;AbpDistributedEntityEventOptions&gt;(options =>
    {
        options.EtoMappings.Add&lt;IdentityUser, UserEto&gt;(typeof(AbpIdentityDomainModule));
        options.EtoMappings.Add&lt;IdentityClaimType, IdentityClaimTypeEto&gt;(typeof(AbpIdentityDomainModule));
        options.EtoMappings.Add&lt;IdentityRole, IdentityRoleEto&gt;(typeof(AbpIdentityDomainModule));
        options.EtoMappings.Add&lt;OrganizationUnit, OrganizationUnitEto&gt;(typeof(AbpIdentityDomainModule));

        options.AutoEventSelectors.Add&lt;IdentityUser&gt;();
        options.AutoEventSelectors.Add&lt;IdentityRole&gt;();
    });

    var identityBuilder = context.Services.AddAbpIdentity(options =>
    {
        options.User.RequireUniqueEmail = true;
    });

    context.Services.AddObjectAccessor(identityBuilder);
    context.Services.ExecutePreConfiguredActions(identityBuilder);

    Configure&lt;IdentityOptions&gt;(options =>
    {
        options.ClaimsIdentity.UserIdClaimType = AbpClaimTypes.UserId;
        options.ClaimsIdentity.UserNameClaimType = AbpClaimTypes.UserName;
        options.ClaimsIdentity.RoleClaimType = AbpClaimTypes.Role;
        options.ClaimsIdentity.EmailClaimType = AbpClaimTypes.Email;
    });

    context.Services.AddAbpDynamicOptions&lt;IdentityOptions, AbpIdentityOptionsManager&gt;();
}

that's what you mean ???

using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Volo.Abp.Account.Emailing;
using Volo.Abp.Account.Localization;
using Volo.Abp.Account.Settings;
using Volo.Abp.Application.Services;
using Volo.Abp.Auditing;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Settings;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
namespace Volo.Abp.Account;
[Audited]
public class AccountAppService : ApplicationService, IAccountAppService, ITransientDependency
{
    protected IIdentityRoleRepository RoleRepository { get; }
    protected IdentityUserManager UserManager { get; }
    protected IAccountEmailer AccountEmailer { get; }
    protected IdentitySecurityLogManager IdentitySecurityLogManager { get; }
    protected IOptions<IdentityOptions> IdentityOptions { get; }
    public AccountAppService(
        IdentityUserManager userManager,
        IIdentityRoleRepository roleRepository,
        IAccountEmailer accountEmailer,
        IdentitySecurityLogManager identitySecurityLogManager,
        IOptions<IdentityOptions> identityOptions)
    {
        RoleRepository = roleRepository;
        AccountEmailer = accountEmailer;
        IdentitySecurityLogManager = identitySecurityLogManager;
        UserManager = userManager;
        IdentityOptions = identityOptions;
        LocalizationResource = typeof(AccountResource);
    }
    public virtual async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
    {
        await CheckSelfRegistrationAsync();
        await IdentityOptions.SetAsync();
        var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id);
        input.MapExtraPropertiesTo(user);
        (await UserManager.CreateAsync(user, input.Password)).CheckErrors();
        await UserManager.SetEmailAsync(user, input.EmailAddress);
        await UserManager.AddDefaultRolesAsync(user);
        return ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
    }
    public virtual async Task SendPasswordResetCodeAsync(SendPasswordResetCodeDto input)
    {
        var user = await GetUserByEmailAsync(input.Email);
        var resetToken = await UserManager.GeneratePasswordResetTokenAsync(user);
        await AccountEmailer.SendPasswordResetLinkAsync(user, resetToken, input.AppName, input.ReturnUrl, input.ReturnUrlHash);
    }
    public virtual async Task ResetPasswordAsync(ResetPasswordDto input)
    {
        await IdentityOptions.SetAsync();
        var user = await UserManager.GetByIdAsync(input.UserId);
        (await UserManager.ResetPasswordAsync(user, input.ResetToken, input.Password)).CheckErrors();
        await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext
        {
            Identity = IdentitySecurityLogIdentityConsts.Identity,
            Action = IdentitySecurityLogActionConsts.ChangePassword
        });
    }
    protected virtual async Task<IdentityUser> GetUserByEmailAsync(string email)
    {
        var user = await UserManager.FindByEmailAsync(email);
        if (user == null)
        {
            throw new UserFriendlyException(L["Volo.Account:InvalidEmailAddress", email]);
        }
        return user;
    }
    protected virtual async Task CheckSelfRegistrationAsync()
    {
        if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled))
        {
            throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]);
        }
    }
}

here is registration function

public virtual async Task<IdentityUserDto> RegisterAsync(RegisterDto input) {

    await CheckSelfRegistrationAsync();

    await IdentityOptions.SetAsync();

    var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id);

    input.MapExtraPropertiesTo(user);

    (await UserManager.CreateAsync(user, input.Password)).CheckErrors();

    await UserManager.SetEmailAsync(user, input.EmailAddress);
    await UserManager.AddDefaultRolesAsync(user);

    return ObjectMapper.Map&lt;IdentityUser, IdentityUserDto&gt;(user);
}
and i use using Microsoft.Extensions.Options; , this function throw exception in await IdentityOptions.SetAsync();

Message Error: Volo.Abp.AbpException: 'Options must be derived from the Volo.Abp.Options.AbpDynamicOptionsManager`1!' in this function "await

hi team

Message Error: Volo.Abp.AbpException: 'Options must be derived from the Volo.Abp.Options.AbpDynamicOptionsManager`1!' in this function "await IdentityOptions.SetAsync(); "when i test register any idea ?

Answer

hi i solved problem, there is a problem in api , thanks

Question

Hi Team Pager in abp framework in users and roles pages doesn't work , i use LeptonXTheme theme , can any one help me please?

Hi could you tell me how can i manually deleting the cache (Permission cache ) in HandleEventAsync method ??

hi i change AbsoluteExpirationRelativeToNow to 60 seconds (AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(60)) it's works fine ,but i want to know if this configuration affect the performance of project ? and AbsoluteExpirationRelativeToNow refresh cache every 60 seconds or when i update permission it takes 60 seconds for the web to refresh ???

i'm not sure if you put my question , but all what i mean to update cache to reflect my changes on permissions so what i can do this class to expire the cache and updated to latest version. ??

Showing 1 to 10 of 32 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35