We're setting up OA2 as a portal site for our customers and using the Domain feature to give each client space a unique subdomain.
So our site structure looks something like this (all of the items are spaces):
- Client 1 Name (URL: http://client1.ourportalsite.com )
- Project 1 (Expected URL: http://client1.ourportalsite.com/project1 )
- Project 2 (Expected URL: http://client1.ourportalsite.com/project2 )
- Client 2 Name (URL: http://client2.ourportalsite.com )
- Project 3 (Expected URL: http://client2.ourportalsite.com/project3 )
- Project 4 (Expected URL: http://client2.ourportalsite.com/project4 )
The problem is that the subspaces do not inherit the domain settings of the parent space and thus they end up with a URL path of http://ourportalsite.com/project1 instead of http://client1.ourportalsite.com/project1.
If we set the domain on the subspace to be the same as that on the parent space then the URL works as expected, but the built-in breadcrumb navigation doesn't work since it only links to the domain, not the domain + subspace path. This results in all of the subspace navigation links going back to the parent level space rather than the subspaces.
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | oa_domain-subspace-inherit-parent-2162997-32.patch | 4.17 KB | gaele |
Comments
Comment #1
mpotter commentedYes, I'll add this to the list for a future release.
Comment #2
shawn_smiley commentedThanks mpotter.
I'll see if I can get one of our devs to work on a patch to add this support.
Do you have any preference on if we make parent settings be inheritable by subspaces or if we update the breadcrumb navigation to include the full path to subspaces with domain settings?
Obviously any guidelines or pointers about how you would like to see this implemented would be much appreciated.
Comment #3
mpotter commentedBy default a subspace should probably inherit the domain of the parent. That seems to make the most sense. Then a subspace can override this by providing it's own domain.
Comment #4
Argus commentedComment #5
kengilb commentedComment #6
kengilb commentedComment #7
kengilb commentedMy apologies, I forgot to account for subspaces of subspaces.
Comment #8
kengilb commentedComment #9
mpotter commentedI'll take a look at the patch, but I will probably generalize it a bit because there are several other properties of spaces that are also not currently inherited, including: colors, banners, etc.
Comment #10
hazit commentedHi there
Sorry to be posting such a simple question here, but I cannot find any trace in any of the documentation or OA support material on how to set this feature up.
I have a registered domain name which I add to the space, but nothing seems to happen. I go to see if I should be changing the url alias but it does not seem to allow users to use anything other than the main domain.
And yes, if I can get the space-as-domain working, it would be great if I were able to have all the subspaces consistently follow the same domain name rules also.
Comment #11
mpotter commentedTo set up a domain for a space, you need to set the domain field for the space as you did, but you also need to go to the admin/openatrium/setting page and set the default domain name that you want to use for the rest of the site.
For sub-space support the patch is in #7. The patch is still in "needs review" state. It has not been committed to the code yet.
Comment #12
mpotter commentedThis still needs work.
The patch in #7 only changes it for the actual subspace node and not the content nodes within the subspace. The proper way to do this would be to modify the oa_domains_get_space_path() routine to check for parent paths. Probably also need to make the $space_id of that function pass-by-reference so it can be updated with the id of the parent space that has a domain set.
Comment #13
hazit commentedRE#11 Thanks Mike - your comments were really helpful and now the domain-per-space is working like a charm. Looking forward to the inheritance functionality as this will also be very useful. Thanks for all your great work.
Comment #14
marqpdx commentedhi Mike and everyone, Thanks for all this. I can confirm it is working for me.
I now need to make the content piece work as well for domain subspaces (per #12).
Mike, the patch in #7 changes oa_domains_url_outbound_alter() to account for parent domains and the full path.
To account for content nodes in the subspace, you suggest we update oa_domains_get_space_path().
Would it make most sense to roll back the patch in #7, and update oa_domains_get_space_path() to cover parents for both subspaces, and subspace content?
I'm willing to have a go at the code (unless you have a version ready to go), but i wanted to get direction about how best to modify the module.
Thanks,
m
Comment #15
mpotter commentedYes, I think doing it in oa_domains_get_space_path would be the best general solution and would love to have help with that.
Comment #16
marqpdx commentedhi Mike,
i made a change that now allows the creation of sections and other content as part of the subspace.
i merely cloned the new section of code from #7 to apply to the content section.
but, what doesn't yet work is create a new User Group.
it doesn't appear that oa_domains_get_space_path() is called anywhere outside the domain module.
Do you know where the group creation logic would need to be adjusted to account for extended domain paths?
thx,
m
Comment #17
marqpdx commentedActually, my bad about the User Group not catching the parent path. This appears to be working.
A parent group was not set automatically during group (which is correct behavior, i just didn't notice).
Sorry about that.
Thx,
m
Comment #18
mpotter commentedmarqpdx: do you have a patch to upload?
Comment #19
marqpdx commentedI will make a patch.
Should i make the patch against the result of the #7 patch above, or make a patch against the released code (meaning it will have the #7 changes plus mine)?
Haven't done it before, but i'll figure it out. Just let me know which patch you want?
thanks
m
Comment #20
dsnopek@marqpdx: The new patch should include all the necessary changes, so: yours plus the changes in the patch from #7.
Comment #21
marqpdx commentedComment #22
marqpdx commentedok, here's my first ever patch, so yay. i hope i did it correctly.
i did it against the 7.x-2.x, and it accounts for both use cases above, the subspace and the content. in either case, the parent domain has to be in the inheritance.
let me know if i did it incorrectly.
thanks,
m
ps - the code is the simpler solution; i didn't refactor, just added the #7 patch solution to the next section down.
Comment #23
dsnopek@marqpdx: The patch file you uploaded is empty. :-/
Comment #24
marqpdx commentedthat was lame. sorry about that.
at least there were no errors :-)
correct one coming.
m
Comment #25
Argus commentedComment #26
marqpdx commentedSo now i am finding that when i try to create a webform, it doesn't pre-pend the domain time (e.g. subsite1.domain.com/content/webform/webform1). hence, error.
I will look into the webform node_save() - unless there is a cool Open Atrium way i don't know about.
thx
m
ps, anyone use that patch?
Comment #27
gaele commented@marqpdx: the patch you uploaded in #24 is exactly the same as the one in #7.
Comment #28
gaele commentedComment #29
hefox commentedUsing one issue queue (open atrium) for all app issues.
Interesting that can assign an issue to a project that has issue tracker disabled...
Comment #30
gaele commentedmarqpdx didn't upload the right patch, so I'm working on it myself. Just to be sure, this is what we're talking about:
Right?
Comment #31
Argus commentedYes, and especially the last step for subspaces, they do not yet auto-inherit the domain settings.
Comment #32
gaele commentedAttached a patch that I tested with a couple of spaces, subspaces, sections, content nodes and custom domains. It seems to work as long as it doesn't get too complicated. (If both a space and a subspace have a custom domain, the permalink creation goes wrong.)
I had a hard time figuring out how this all works and should work, as I am not really familiar with OA. On the way I did some refactoring.
The next few days I'm available to help out, after that I will be away for two months.
Comment #33
Argus commentedTested the patch and it seems to work fine.
Comment #34
Argus commentedIn
admin/contentthe links sometimes are displayed incorrectly, namely without the subdomain. This occurs only whenadmin/contentis viewed from another subdomain.Say I have 2 private Spaces: site1.example.com and site2.example.com and site2.example.com has a subspace called "mysubspace" with a News Section.
Documents created in this section can be seen in
site1.example.com/admin/content(imho they shoudn't because both Spaces are private and so content in them should also be private, but that's another matter), but they link toexample.com/mysubspace/sectionname/nodetitleinstead ofsite2.example.com/mysubspace/sectionname/nodetitlelike they should.Comment #35
hosais commented@Argus
I am also testing this. As I mentioned here https://www.drupal.org/node/2265627#comment-9464243, you will see posts of other domains if you have privilege to access the space (no matter what domain it is). So "both Spaces are private ..." I think it is correct behavior. Do I misunderstand you? (Are you saying that some user can see the private info but he/she is not the member?)
Your latest point seems that the domains are not correct but my part looks good. I even changed the parent of one sub domain. After refresh few times, all the links are changed correctly. Do you clear the cache when you tested? It does not work for me until I clear the cache. (I also restart the web server. Well, I am not sure exactly how the replace domain works here).
Comment #36
hosais commentedI have one issue here though.
When I do admin/content, the links are with different domains correctly; however, I can access every spaces/contents (if I have right to access) with the wrong domains by type it directly in the address in browser.
For example, you can access both domain1.example.com/subspace1 and site2.great.com/subspace1
Or domain1.example.com/subspace1/document1 and site2.great.com/subspace1/docuemnt1
About domain1.example.com and site2.great.com you can access by the path alias. For example,
site2.great.com/domain1_example domain1.example.com/sites2_great
This for me is wrong behavior and may have problem of SEO.
About SEO, since it is not related to inheritance, I create another new post here: https://www.drupal.org/node/2409843
Comment #37
hosais commentedSince it did not work in the beginning so I traced the code. (After clean the catch and refresh few times it works)Just curious: two quesion about the patched code
This code is handling if the parents (direct parents, not grandparents) has more than one.
The code is not finding the last called parent. It is the base domain.
In this case, the behavior definition actually is NOT clear, since two parents' domains may end up with different domains and which one should be it? Currently, I suggest just pick one of it => so this "if body" should do nothing (= one parent, choose parent[0]).
In my use case, it should has only one domain since all the subspace should has only one same domain ancestor. With this definition, just pick one of them is OK. That I suggest define when a space has two parents, just pick one of them and the admin need to maintain it correctly or some error message or prevention put into the code. What do you guys think?
=========================================================
Note: My test procedures are with two domains.
a.One is base domain. Two space here with some contents.
b.Another domain2 (NOT the base domain) has 3 sub-spaces which have one news section and one news content.
Domain2 space->course->business course->sub_B1course
only domain2 has customized domain.
c. add a parent to sub_B1_course. The parent has different domain from Domain2. To see how it works.
hosais
Comment #38
dsnopekThe patch in #32 is working for me in my local dev environment. It's going to get some testing in production soon too. :-)
The only thing that concerns me in the code is a little bit of duplication - we see this same (more or less) code block twice:
That said, this isn't the worst sin! But if it could be done without duplicating this code, that would be better. :-)
Comment #39
dsnopekHide some of the old patches.
Comment #40
gaele commentedRe #37: As I mentioned I'm not that familiar with OA Domains. You're right that this is a strange piece of code. I based my patch on #7, and left this part as I wasn't really sure what it is about. If you think this can be improved go ahead.
Re #38: Yup, that's ugly :-) I cleaned up quite a bit just to understand what is going on in the code. More refactoring seems possible, but that decision is probably up to the maintainers? I didn't feel comfortable both adding a feature and changing so much code.
Comment #41
Argus commentedAny chance for this patch to get commited?
Comment #42
mpotter commentedI updated this patch from #37. Regardless of how many parents there are, the first parent is always the direct parent for inheritance. Didn't do anything for #38.
Did some testing and it seems to be working well. Committed to 9a79de1 of oa_domains.