3

Resolved

Multi tenancy Content Picker permissions/content

description

I have a setup multi tenany with a few sites. When I use the content picker in one of the tenants (backend) for looking up an menu content item it shows all the content items of all tenants. So that's a security and usability problem or am I do doing something wrong?

comments

jusquiano wrote Mar 9, 2013 at 10:05 PM

i am also having trouble adding content types using contentpicker in a multitenant site. In the default tenant the content picker is working fine, but in other tenants the behavior is weird. The content items are not being saved.

SaaSDeveloper wrote Jun 24, 2013 at 7:01 PM

Yes there is a bug when using a prefix for the tenant identifier. Otherwise it will work fine with the sub-domain approach.

Jimasp wrote Jul 8, 2013 at 1:15 PM

Problems with MultiTenancy using url prefix

Seems to affect all Orchard versions (tested on 1.6.1 and 1.x)
  1. Enable Multitenancy.
  2. Create a new tenant, with no host, but with a url prefix, e.g. testtenant
  3. Setup the tenant.
  4. Go to the new tenant admin page for navigation e.g. mysite/testtenant/admin/navigation
  5. Click "Add content menu item", then click Browse button
    Note that the url is mysite/Admin/... and not mysite/testtenant/admin/... as expected.
    This is the first problem.
  6. Go to mysite/testtenant/Admin/Contents/Create/Page
    Add a title of "mytenantpage"
    Click Publish Now
    Note that the permalink is set to mysite/mytenantpage and not mysite/testtenant/mytenantpage as expected.
    This is the second problem.

Jimasp wrote Jul 8, 2013 at 1:59 PM

Partial fix. (addresses "first problem" mentioned in last post):

In the file Parts.ContentMenuItem.Edit.cshtml:

var baseUrl = Url.Content("~/") + WorkContext.Resolve<ShellSettings>().RequestUrlPrefix;

Change this line:
baseUrl: '@Url.Content("~/")' to baseUrl: '@baseUrl'

Jimasp wrote Jul 8, 2013 at 2:01 PM

Reformatting last post (can't edit):

Partial fix. (addresses "first problem" mentioned in last post):

In the file Parts.ContentMenuItem.Edit.cshtml:

Add this line near the top of the file:
var baseUrl = Url.Content("~/") + WorkContext.Resolve<ShellSettings>().RequestUrlPrefix;
Change this line:
baseUrl: '@Url.Content("~/")' 
to
baseUrl: '@baseUrl'

Jimasp wrote Jul 8, 2013 at 2:17 PM

oh, i forgot the using statement:
using Orchard.Environment.Configuration

Jimasp wrote Jul 8, 2013 at 2:30 PM

Solution to second problem (note that actually the page is created in the tenant correctly, it's just the label that is wrong).

near the top of the file Parts.Autoroute.Edit.cshtml, add these lines again:
@using Orchard.Environment.Configuration
var baseUrl = Url.Content("~/") + WorkContext.Resolve<ShellSettings>().RequestUrlPrefix;
then replace the lines
<span>@ViewContext.RequestContext.HttpContext.Request.ToApplicationRootUrlString()/</span>
and
<span>@ViewContext.RequestContext.HttpContext.Request.ToApplicationRootUrlString()/@Model.CurrentUrl</span>    
with the line
<span>@ViewContext.RequestContext.HttpContext.Request.ToApplicationRootUrlString()@baseUrl/</span>

sebastienros wrote Jul 10, 2013 at 9:41 PM

Fixed in changeset f44171e9b4c8

sfmskywalker wrote Mar 28 at 12:28 AM

Fixed in changeset 8162f99dbf77d445e9bcd6e889afea800e2ebfc1