Multisite capabilities of Neos


(Karsten Dambekalns) #21

Yeah, sorry… Said packages seem to work just fine, I just forgot to add them here. Glad you found them!


(Benjamin Klix) #22

When using the package flownative/neos-multisitekickstarter i cannot log in to Site B (Neos 3.3) and instead get the following error:

Call to a member function hasActiveDomains() on null
Exception Code	0
Exception Type	Error
Thrown in File	Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Neos_Service_LinkingService.php
Line	301
Original File	Packages/Application/Neos.Neos/Classes/Service/LinkingService.php

Line 301 is: if ($site->hasActiveDomains()) {

Before you have the following variables (when logging in to Site B to the home page (/sites/site-b):

  • $siteNode: Instance of NodeInterface with the correct context path (/sites/site-b@user-siteb)
  • $resolvedNode: Instance of NodeInterface with context path of site A (/sites/site-a@user-siteb, expected: /sites/site-b@user-siteb)
  • $siteNodeName: Name of the site node for site A (site-a, expected: site-b).

Did anybody else get the same behaviours or can tell me how to fix this?

Update:

The described behaviour does also occur when not using the package flownative/neos-multisitekickstarter.


(George Dimitriadis) #23

I don’t remember the exact errors I was getting when I was trying to get this to work, but I’ll share a few points that gave me trouble.

Personally I went through Aske’s tutorial step my step (yes, I tried to just copy-paste at first, but obviously failed :P).

Getting the tutorial to work with 3.3 is the first step, some namespaces need adjustment (I think this is the only issue). After that, I had to adjust the privileges to match my project setup.

In my case, I had a project structure with one main site in Neos and I wanted to add other sites dynamically in subdomains, under a specific site package. For this, I had to add an extra rule that didn’t block read access to the main site, because being under the same domain triggered some calls to the main site (I think). If the domain of your siteA and siteB are completely different, you probably don’t have this problem.

For the multisite kickstarter I didn’t use it in the end, but it was a nice reference to see how they handled their policy. And from what I noticed, what the multisite kickstarter does is to generate a Policy.yaml file and add it to a newly created site package for your site. In my case I didn’t want that, I used the same site package for all subdomain sites and another site package for the main site, so using multisite kickstarter for my use case was not going to work I think.


(Benjamin Klix) #24

Hey @dimitriadisg,

thanks for your feedback. I use two different domains, so two site packages that share some parts with each other but each one is for itself.

I also didn’t use the kickstarter to create the policy files and instead simply c&p them to my sites packages (with some adjustments in namings etc.). I only used flownative/neos-multisitehelper for the authentication provider.

The strange thing is, that i can log in to Site A without any issues (with a user that only has access to Site A) but the same does not work for Site B. Some variables do have the wrong values assigned (from my point of view), but maybe i’m wrong here.

Would be great if maybe @aertmann or @bwaidelich can help some more here.


(Karsten Dambekalns) #25

Well, do both sites have domains assigned? Are both sites and their packages active? Because obviously the site cannot be found, for some reason?


(Benjamin Klix) #26

Both sites do have domains assigned and both sites and their packages are active.
The thing is, that i can view the page and also log in to the page with an admin user. Will make further tests this week with other permissions.


(Benjamin Klix) #27

Some more information, as this is still only working for site A:

  • Both sites/packages are listed under /neos/administration/packages as active site package.
  • Both sites do have a domain assigned.

Composer Requirements:

  • None of both site packages is included in the main composer requirements.
  • Site A has this requirements:
    • neos/neos
    • flownative/neos-multisitehelper
    • … + some packages that have some predefined nodetypes used over multiple neos setups.
  • Site B has this requirements:
    • neos/neos
    • flownative/neos-multisitehelper
    • package/site-a

Again the problem:

  • I can login on Site A with a user that only has access to Site A
  • I can NOT login on Site B with a user that only has access to Site B
    • Error 500: Exception: Call to a member function hasActiveDomains() on null (see above)
  • I can login on both Sites with an administrator

I hope someone give me some further tipps.


(Benjamin Klix) #28

So, now i found the source for this problem. It is in the package Neos.Neos.Ui.
In the file Resources/Private/Fusion/Backend/Root.fusion in line 196 (plus-minus) there is a node uri being generated using Neos.Neos:NodeUri which uses the first site node found (instead of the current site :thinking:). If you do not have access to this other sites, the link can not be generated. Can anybody tell my, why not the current site but the first site is being used?

Code:

backend.menu.content {
    uri = Neos.Neos:NodeUri {
        node = ${q(site).parent().children().get(0)}
    }
}

Maybe someone from the ui rewrite (@dimaip, @sebastian, …) can tell, why the first site instead of the current site is used here.


(Sebastian Kurfuerst) #29

Hey @BenjaminK,

that’s a really good question. Looking at git blame , that looks to me like it is a bug.

Does it work if you change it to just “site”? :slight_smile:
All the best,
Sebastian


(Benjamin Klix) #30

As mentioned in the Issue on GitHub it is working with just “site”. So i really think this is a bug.


(Sebastian Kurfuerst) #31

Hey Benjamin,

thank you so much for your detailed error description and the proposed fix, which looks great to me :heart:

All the best,
Sebastian