Dear ismcagdas, after I set Account / Login as default route - after successful authentication I still see a login page and I cannot navigate to any other page :-( So I have to redirect to /home/index in Login action of MVC controller. But then I allways get <a class="postlink" href="http://localhost:1234/home/index#">http://localhost:1234/home/index#</a> in my URL.
What would be the best way to solve all three problems: *avoid log entry about unauthorized request *redirect to Home / Index after login *keep http(s)://server/# URL without "/home/index"
Thank you in advance.
and the answer is: <a class="postlink" href="https://stackoverflow.com/questions/44287171/login-over-ajax-use-cookie-in-mvc-angular-cors">https://stackoverflow.com/questions/442 ... gular-cors</a>
Cookie-based authentication doesn't work cross-origin, because cookies are always domain-bound, regardless of your CORS settings. – Chris Pratt
Hello. Simply override SaveChanges in your DbContext class:
public override int SaveChanges()
{
try
{
return base.SaveChanges();
}
catch (DbEntityValidationException ex)
{
var errorMessages = ex
.EntityValidationErrors
.SelectMany(x => x.ValidationErrors)
.Select(x => x.ErrorMessage);
var fullError = string.Join(Environment.NewLine, errorMessages);
var exceptionMessage = string.Concat(ex.Message, Environment.NewLine, "Validations errors are:", Environment.NewLine, fullError);
throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
}
}
On the last two lines of your exception it is written:
WARN 2016-08-31 17:00:44,074 [7 ] nHandling.AbpApiExceptionFilterAttribute - There are 1 validation errors: WARN 2016-08-31 17:00:44,074 [7 ] nHandling.AbpApiExceptionFilterAttribute - The Name field is required. (input.Name)
Clearly you are missing input.Name parameter :-)
Hello, did you made it? I do also need to implement similar deployment schema.
Thank you for your answer.
Background of a problem: companyM (lest call it tenantM) signed an business agreement, that users of companyM will work on behalf of companyS1, companyS2 and companyS3 (tenantS1, tenantS2, tenantS3 respectively), while still using they'r own logins into system.
My purpose is to let userM1 of tenantM to work as userM1 of tenanS1, and tenantS2 and so on.
If I follow your suggestion - I shall create DUMMY userS1, userS2, userS3 for every user of tenantM1, is that correct?
Hello, so I will ask my question shortly: is there any easy way to achieve a functionality, that user from one tenant could act on behalf of another tenant?
Thank you.
Hello. First of all - thank you for your great work. ABP is awesome.
On already working ABP (AngularJS + EF) application I need to implement functionality where admin user of one tenant can act as any user of another tenant.
In order to replace IAbpSession.TenantId I have derived ClaimsAbpSession, registered it in module:
public class MyAbpSession : ClaimsAbpSession
{
public MyAbpSession(IMultiTenancyConfig multiTenancy) : base(multiTenancy) {}
private int? _tenantId;
public int? SetCurrentTenantId
{
set { this._tenantId = value; }
}
public override int? TenantId
{
get
{
var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal;
if (claimsPrincipal == null)
return null;
return this._tenantId ?? base.TenantId;
}
}
}
But I still have MayHaveTenant filter problem. Is there any chance I could globally set filter parameter for all UnitsOfWork?
_unitOfWorkManager.AllUnitsOfWork.SetFilterParameter(AbpDataFilters.MayHaveTenant, AbpDataFilters.Parameters.TenantId, input.TenantId.Value);
And this has to be done from Impersonation method (any ApplicationService or AccountController in .Web), not from module initialization.
I can not disable AbpDataFilters.MayHaveTenant / AbpDataFilters.MustHaveTenant globally, because impersonator must see only data of Tenant, that she is impersonating.
What I have tried:
What would be the best solution to achieve my business requirement?
I am even thinking of creating identical AbpUsers (and synchronizing for password change and so on) for each tenant, that a user must have access to... Is ASP.NETZERO has fully implemented impersonation (on features it says "User and Tenant impersonation")?
Could you please provide some advise to this problem? Thank you in advance.