Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Multi Tenancy #27

Open
Tabgyn opened this issue Aug 11, 2017 · 11 comments
Open

Support for Multi Tenancy #27

Tabgyn opened this issue Aug 11, 2017 · 11 comments
Milestone

Comments

@Tabgyn
Copy link

Tabgyn commented Aug 11, 2017

I would like to know if you have plans to add support for multi tenancy.

@EduardoPires
Copy link
Owner

It's a good idea, I'll think about.

@CanMehmetK
Copy link

When V3 will be visible ?
IdentityServer and MultiTenancy needed :)

regards

@murbanowicz
Copy link

In the meantime: Where should multitenancy authorization sit? As it has to access the resource, it looks like it should call AuthService inside the Repository but is it in line with the patterns ?
Auth has to check the tenantId of the resource and compare it with user tenantId... Can anyone help?

@CanMehmetK
Copy link

CanMehmetK commented Feb 5, 2018

I solved with this. but needs caching,Injectable to views/layouts ext. by the way saves the day 👍
Contributers of this project will do better , i am sure on that.

Startup ;
services.AddScoped(typeof(TenantAttribute));

Controller
[ServiceFilter(typeof(TenantAttribute))]
[Area("Management")]
public class UserController : BaseController
{ .... }
Attribute
public class TenantAttribute : ActionFilterAttribute
{
private readonly EquinoxContext _dbContext;
public TenantAttribute(EquinoxContext dbContext)
{
_dbContext = dbContext;
}

    public override void OnActionExecuting(ActionExecutingContext actionExecutingContext)
    {

        var fullAddress = actionExecutingContext.HttpContext?.Request?.Headers?["Host"].ToString();
        var tenant = _dbContext.Tenants.Where(t => t.url == fullAddress);           
        actionExecutingContext.RouteData.Values.Add("tenant", tenant);
   }

}

@Tabgyn
Copy link
Author

Tabgyn commented Feb 5, 2018

Take a look at the SaasKit project: https://github.com/saaskit/saaskit
I've used it and it met my needs well.

@leonardoaguiar
Copy link

leonardoaguiar commented Feb 5, 2018 via email

@murbanowicz
Copy link

murbanowicz commented Feb 5, 2018 via email

@Tabgyn
Copy link
Author

Tabgyn commented Feb 5, 2018

Even though it seems abandoned, the source code is still there.

This other project uses SaasKit with Asp.net Core and was my starting point:
https://github.com/janaks09/NetCoreSaaS

In my account also have a project made from SaaSKit, although incomplete.

@leonardoaguiar
Copy link

leonardoaguiar commented Feb 5, 2018 via email

@brunobritodev
Copy link

@leonardoaguiar

Edit your comment and remove your cellphone :)

@leonardoaguiar
Copy link

@leonardoaguiar

Edit your comment and remove your cellphone :)

Done. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants