Base solution for your next web application
Open Closed

Render tenant specific page using ViewLocationExpander #9888


User avatar
0
ISTeam created

Product Info

  • What is your product version? (ANZ Core & jQuery 8.4)
  • What is your product type (MVC & jQuery)?
  • What is product framework type (.net core)?

Issue

We want to develop "Product Detail" kind of page somewhat like Amazon. Which can have image and other information about the product. For the first client we want to hide few sections and other clients as well we may customize the page a bit in future or may be not in a group.

For this type of tenant specific customization of "Product Detail" page, instead of defining tenant settings and any other complex implementation, I found that it is possible to render view from TENANT named folder as mentioned here using ViewLocationExpander : Link1 and Link2

Is it possible to implement this in ANZ? If so, should I implement "GetCurrentTenant()" method to get TENANCY name in "TenantViewLocationExpander" as shown in first link? Even after overriding this method in TenantAppService or to use "TenantManager" it does not work as tenants do not have (AppPermissions.Pages_Tenants) permission.

My goal is to have views like below directory structure to be rendered :

ProductDetail (view directory) ----TENANT1 (tenancy name directory) --------Index.cshtml (tenant specific page) ----Index.cshtml (default page)

can you please put a light if we can implement this?

Thanks.


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ISTeam

    Did you try to inject TenantManager into TenantViewLocationExpander ? You can also get TenantId by injecting IAbpSession. You don't have to implement a custom tenant resolver becuse AspNet Zero already does that.

    I couldn't understand the problem related to Permissions but you can always swtich to Host side as explained here