Redirect nodes when inactive domain selected as source

BWPanda - August 31, 2009 - 02:35
Project:Domain Access
Version:6.x-2.x-dev
Component:- Domain Source
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Here's a scenario:
You create a node and assign it to domain_1 and domain_2. Domain_1 is active, while domain_2 is inactive. When you try to view the node, it attempts to take you to domain_2's site to view it, but as it's inactive, it just takes you to the primary domain's homepage.

Because this node is also available on domain_1, which is active, I think it'd be nice if it took you to domain_1 to view the node, until domain_2 becomes active...

The pseudo-code might be something like this:

get source_domain
if source_domain inactive
  get array of other assigned_domains
  foreach assigned_domains
    if assigned_domain active
      domain = assigned_domain
    end if
  end foreach
else
  domain = source_domain
end if
view node at domain

Thoughts?

#1

agentrickard - August 31, 2009 - 06:04

Well, this is avoidable now, using Domain Source, but you're asking for a fallback protection as well? We typically don't do such redirects for individual nodes.

#2

BWPanda - August 31, 2009 - 06:53

In that case, how about limiting the Domain Source selection to only active domains...?

#3

agentrickard - August 31, 2009 - 17:21

That seems reasonable to me, except that active/inactive can change, so the first option may be better.

Other opinions.

#4

agentrickard - October 11, 2009 - 17:48

Hm. This is a sticky problem. The issues are:

1) Sometimes we want to assign nodes to inactive domains (for staging purposes).
2) The function that changes the link path is in custom_url_rewrite_outbound(), and hard to change.
3) The custom_url_rewrite_outbound() output would be cached, so having a permission-based change here really won't work.
4) It is also too late to handle this in hook_nodeapi().

The only options seem to be:

a) Do nothing
b) Restrict source to valid only (which I don't like)
c) Try to intercept things in hook_boot() or hook_init() to prevent the redirect to the primary domain.

I don't like any of these options. c) would introduce overhead.

#5

agentrickard - October 11, 2009 - 19:09

Hm. Well, we really can't have Domain Source pointing to an invalid domain. Two patches here.

1) Simply remove the invalid nodes from Domain Source. This will require #540684: Set active domain as source to be valid.

Test this in 564070-source.patch

2) A larger fix for accessing invalid domains, which will likely go in. It passes the invalid request to the best natural matching domain.

Test this in big.redirect.patch.

AttachmentSize
564070-source.patch 1.45 KB
big.redirect.patch 3.41 KB

#6

agentrickard - October 15, 2009 - 14:48
Status:active» needs review

#7

agentrickard - October 24, 2009 - 15:39

The smaller patch has been committed.

#8

agentrickard - October 24, 2009 - 20:12
Status:needs review» fixed

And the larger as well.

#9

nonsie - October 27, 2009 - 00:36
Status:fixed» active

I was testing HEAD without Domain Source enabled and gave a user 'access inactive domains permission'. Even though the user can browse content on this domain he is not able to publish to it despite of having set domain access permission. I'm a bit out of loop re latest fixes but it seems to contradict with the purpose of set domain access permission. Am I wrong or should I be looking for a bug?

#10

agentrickard - October 27, 2009 - 13:02
Status:active» needs review

Looks like I missed two cases of the new permission.

AttachmentSize
546070-valid.patch 1.39 KB

#11

agentrickard - October 27, 2009 - 13:05

I just committed the above patch for testing.

#12

nonsie - October 28, 2009 - 20:55
Status:needs review» reviewed & tested by the community

Patch applies and is correct.
This brings up another pet peeve of mine - there is no indication that the domain is inactive in the domain list. Perhaps we should have a theme fuction so that one could theme the displayed site name as they wish? I've altered it in the past in a custom module (sometimes sitename means less than its url for example).

#13

agentrickard - October 28, 2009 - 21:22

Huh? Status is a column in the domain list.

#14

agentrickard - October 28, 2009 - 21:23

A patch for theming the domain name would be separate. I would do something like:

theme('domain_name', $domain, $context);

Where $context might indicate various display uses (like Domain Nav vs. the Domain List).

#15

agentrickard - October 28, 2009 - 22:37
Status:reviewed & tested by the community» fixed

#16

nonsie - October 28, 2009 - 23:24

Let me clarify - when I mentioned domain list in #12 I meant the domain check boxes on node forms.

#17

agentrickard - October 29, 2009 - 14:45

We should do that in D7 and backport. We need a function that generates that list for you, since we use it in about 8 places right now.

#18

System Message - November 12, 2009 - 14:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.