So the site form still has corner case issues with platform access control.

I've been beating my head against the wall with this for about 4 hours and so these are partially notes for myself because I can't look at this stuff any longer today...

These issues are probably not too critical because they are a) only when Clients/platform access control is in use, and b) only when a client only has access to a drupal 7 platform and nothing else

1)
If the only platform available is Drupal 7, only the Drupal 7 profiles will be shown. This is fine
However we have:

   if (!isset($node->profile)) {
     $node->profile = hosting_get_default_profile($return['profile'][0]);
   }

Problem: first of all, hosting_get_default_profile looks like this:

function hosting_get_default_profile($default = null) {
 if ($p = hosting_get_package(variable_get('hosting_default_profile', 'default'))) {
   return $p->nid;
 }
 elseif ($p = hosting_get_package('standard')) {
   return $p->nid;
 }
 return $default;
}

Isn't this always going to return 'default' ? In any case that's what seems to happen, which of course since there's no drupal 6 platform available, it says 'No valid choices' in the Platform field until one of the d7 profiles is clicked.

Shouldn't it first check for $default and load that package (we *are* passing it an argument after all) ? And if not, continue on with the rest? And I don't think that 'standard' one would ever be loaded if we check for a default in the variables table first.

It should just go off $default and load that, and if that fails, consult the variable. But I might've been staring at this too long.

2)
Even if we did fix 1), we are selecting $profile[0], and I don't think the array keys are right here - I seem to see a different profile selected by default that is hidden by the javascript, so no profile is selected by default. This doesn't seem to be the case if there's a d6 platform available, so it seems related to 1)

3)
There seems to be some duplication in hosting_site_available_options and hosting_site_form, especially where profiles and platforms is concerned. Does the form get loaded first and then hosting_site_available_options is interrogated by the javascript.. possibly it's just one of those 'hostslave/hostmaster' clauses that needs to be ripped out..

Comments

sfyn’s picture

The actual duplication is between _hosting_site_field and hosting_site_available_options, I think.

Nope, I see what's going on. You're right - available_options and hosting_site_form call the same functions.

adrian’s picture

the profile_name thing is useful for someone building a hosted service for just one type of site.

Robin Millette’s picture

subbing

anarcat’s picture

Seems to me this stuff could all be rewritten from scratch.. :P See also #967888: meta: refactor site form.

chertzog’s picture

Status: Active » Closed (duplicate)

It seems to me like the site form issues should be handled in #967888: meta: refactor site form.

And the following issues address platform access:
#1345120: platform access control settings should allow full access to the platform
#899764: Taxonomy or role-based platform access control for site creation

So i think we can close this issue as a duplicate of the linked issues.