Just
public async Task CustomUserImageUpdate(string userId, IBlobContainer lobContainer, string image)
{
try
{
byte[] imageBytes = Convert.FromBase64String(image);
await lobContainer.SaveAsync(userId, imageBytes, true);
await SettingManager.SetForUserAsync(userId, AccountSettingNames.ProfilePictureSource, "2");
}
catch (Exception ex)
{
throw;
}
}
Hi,
Try:
User.SetIsActive(false);
Hi,
If your answer is negative on either question
The Saas module is designed to assign a single edition to a tenant; it can't assign multiple editions.
As I understand, you want user-level feature control. I think you can do this with Features.
First, you can use the Entity extension to add EditionId for the user.
EditionId for the userAnd add a new FeatureValueProvider:
public class UserEditionFeatureValueProvider : FeatureManagementProvider, ITransientDependency
{
public override string Name => "TE";
private readonly ICurrentPrincipalAccessor _currentPrincipalAccessor;
public UserEditionFeatureValueProvider(
IFeatureStore featureStore,
ICurrentPrincipalAccessor currentPrincipalAccessor)
: base(featureStore)
{
_currentPrincipalAccessor = currentPrincipalAccessor;
}
public async override Task<string> GetOrNullAsync(FeatureDefinition feature)
{
// find the EditionId for current user, you can use cache or claims for performance
var user = await UserRepository.GetAsync(...currentUserId);
var userEditionId = user.GetProperty<string>("EditionId");
if(userEditionId.IsNullOrWhiteSpace())
{
return null;
}
return await Store.GetOrNullAsync(feature.Name, EditionFeatureValueProvider.ProviderName, userEditionId);
}
}
Related document:
Hi,
I created an issue for this. You can check: https://github.com/abpframework/abp/issues/19656
Your ticket was refunded.
Hi,
You can override the register method to set the IsActive value to true
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAccountAppService))]
public class MyAccountAppService : AccountAppService
{
public override async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
{
await CheckSelfRegistrationAsync();
if (await UseCaptchaOnRegistration())
{
var reCaptchaValidator = await RecaptchaValidatorFactory.CreateAsync();
await reCaptchaValidator.ValidateAsync(input.CaptchaResponse);
}
await IdentityOptions.SetAsync();
var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id);
user.IsActive = false; // inactive user
input.MapExtraPropertiesTo(user);
(await UserManager.CreateAsync(user, input.Password)).CheckErrors();
(await UserManager.AddDefaultRolesAsync(user)).CheckErrors();
if (!user.EmailConfirmed)
{
await SendEmailConfirmationTokenAsync(user, input.AppName, input.ReturnUrl, input.ReturnUrlHash);
}
return ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
}
}
And override the error message:
https://github.com/abpframework/abp/blob/d6063204f41e9cb9e57d7c2592d866735d970c9a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json#L13
https://docs.abp.io/en/abp/latest/Localization#extending-existing-resource
Hi,
InitialSelect2 is not a method provided by ABP.
Could you share a simple project to reproduce the problem? I will check it. thanks. shiwei.liang@volosoft.com
Hi,
You can add your own IAuthorizationRequirement to check the scope and child scope.
Here is a simpler way:
You can check scope in middleware:
app.Use(async (context, next) =>
{
if (context.Request.Path.ToString().Contains("/api/audit-logging"))
{
// check users's ciaml here.
}
await next();
});
Hi,
You can try something like this: https://stackoverflow.com/questions/71769968/asp-net-core-web-api-use-roles-and-requiredscope-concurrent
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AuditLogsController))]
[Authorize("auditlogging")]
public class MyAuditController : AuditLogsController
{
public MyAuditController(IAuditLogsAppService auditLogsAppService) : base(auditLogsAppService)
{
}
}