Activities of "Priyanka"

Hi,

Because ABP uses the CurrentUser.Id as the LastModifierId value.

You can try:

private ICurrentPrincipalAccessor _currentPrincipalAccessor; 
 
.... 
 
 
var claims = new List<Claim>(){ new Claim(AbpClaimTypes.UserId,user.Id)}; 
using(_currentPrincipalAccessor.Change(claims)) 
{ 
    _repository.UpdateAsync(..., autoSave: true) 
} 

Thank you. It is updating now.

I have one API which is called by external service and function in this service is AllowAnonymous. When user is calling this service we are taking user id as input to verify if user have rights to access the application, then on the service call we are updating one table in DB, I'm assigning LastModifierId as user id (which I received in input ) at the same time I'm assigning same user id in one more field (CCFLastModifierId), after successful update I found CCFLastModifierId is updated in DB but LastModifierId is not updating. Could you please help to understand the reason and how can I solve this problem.

I tried to assign the value by

  1. ObjectHelper.TrySetProperty(fc, x => x.LastModifierId, () => user.Id);
  2. tablename.LastModifierId= user.Id;

Both are not working.

ABP Framework version: v5.3.2

UI Type:React

Database System: EF Core (SQL Server)

Tiered (for MVC) or Auth Server Separated (for Angular): yes

Exception message and full stack trace:NA Call AllowAnonymous function from 3rd party and update few columns in table.

Sorry, should be CompleteAsync. (because there is no IDE code prompt here)

ok, thank you for the solution. It is working.

Hi,

you need to roll back the main transaction, and create a new transaction to record the log.

try 
{ 
   await _repositpry.InsertAsync(...xxxx, autoSave: true) 
} 
catch(exception e) 
{ 
   await _unitOfWorkManager.Current.RollbackAsync(); 
} 
final 
{ 
  using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) 
  {  
       ..... 
        
       await uow.CommitAsync(); 
  } 
} 

Hi, Thank you for the solution but uow.CommitAsync() is having compile time error

Can we use CompleteAsync? What is the difference between commit and complete here in this case ?

i meant something like this here;

https://github.com/serilog-mssql/serilog-sinks-mssqlserver

does that work for you?

Log event is already there, we have case where our service is called by external user so we are keeping log of that service where we need to keep request message, response message, current status, messageId etc and this table data is accessible to user to know the status of request hence we are keeping in separate table. Please help me with the solution to insert data in my log table without any exception of try block transaction.

why don't you configure a serilog sink to db? and just call Logger.LogError or something?

We have requirement to keep log in DB. While Inserting in DBlog table I'm getting the same exception which I want to log in DB table.

I have a service where I'm doing Insert and update in Mutiple table and in case of any exception, I'm logging in DB log table in finally section. I'm getting this exception in Insert or update "String or binary data would be truncated in table 'Addresses', column 'Street'. Truncated value: 'Severe depressive episode without psychotic symptoms, not specified as arising in the postnatal peri' , now when I'm logging the error in DB log table, on insert of log table I'm getting the same exception. My Log method for DB log have attribute- [UnitOfWork(IsDisabled = true)], seems like on log insert it is trying to complete the whole transaction, how to resolve this?

ABP Framework version: v5.3.2

UI Type:React

Database System: EF Core (SQL Server)

Tiered (for MVC) or Auth Server Separated (for Angular): yes

Exception message and full stack trace:NA

Steps to reproduce the issue: Call Insert where some exception is there and in Finally call insert to log the exception in logTable.

sure, but what is the difference between both, as per my understanding we can call LoggedOutModel after overriding.

What is the difference if we call below mention functions: await httpContext.RequestServices.GetRequiredService<AbpSignInManager>().SignOutAsync(); await httpContext.RequestServices.GetRequiredService<LoggedOutModel>().OnGetAsync();

ABP Framework version: v5.3.2

UI Type:React

Database System: EF Core (SQL Server)

Tiered (for MVC) or Auth Server Separated (for Angular): yes

Exception message and full stack trace:NA

Steps to reproduce the issue: Login and Logout

Hi,

So, preventing concurrent logins from different browsers is working now but the previous browser did not redirect to the login page

You can redirect:

if (httpContext.User.Identity != null && httpContext.User.Identity.AuthenticationType == "Identity.Application") 
{ 
    await httpContext.RequestServices.GetRequiredService<AbpSignInManager>().SignOutAsync(); 
    //await httpContext.ChallengeAsync("Identity.Application"); 
     
    var redirectUrl = "..."; 
    httpContext.Response.Redirect(redirectUrl); 
    return; 
} 

I tried this but it is stuck in infinite loop, it is redirecting to login and somehow it is coming again on this condition, condition is satisfied and redirecting again and this whole process is keep going.

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