backdrop-contrib / domain

A domain-based access control system for Backdrop CMS
https://backdropcms.org/project/domain
3 stars 5 forks source link

Default domain is not shown in domain list until settings are saved #13

Closed yorkshire-pudding closed 6 months ago

yorkshire-pudding commented 9 months ago

This is with the diff from #12 added.

Steps to reproduce

  1. Disable and uninstall Domain Access (domain)
  2. Enable it
  3. Go to admin/structure/domain

Expected result Current domain is populated as primary domain

Actual result Domain list is empty although primary domain is visible on admin/structure/domain/batch

  1. Go to admin/structure/domain/settings
  2. Without changing anything, click Save
  3. Go to admin/structure/domain

Primary domain is now listed here.

sudipto68 commented 8 months ago

@yorkshire-pudding @stpaultim I could recreate this. I tried to debug, why this is happening and I found that these blocks of code(on domain.admin.inc file line number 57) are not running when we install the module.

while ($domain = $result->fetchAssoc()) {
    if(!empty(domain_api($domain))) {
      $domains[$domain['domain_id']] = domain_api($domain);
    }
  }

That's Why it is not getting the default domain in the list and goes to this code

if (empty($domains)) {
    $form['error'] = array(
      '#markup' => t('No domains have been configured. <a href="!url">Add a new domain</a>.', array('!url' => url('admin/structure/domain/create'))),
    );
    return $form;
  }

But When we save the settings page configuration then the above code while ($domain = $result->fetchAssoc()) runs and we get the default domain in the domain list.

stpaultim commented 6 months ago

@yorkshire-pudding and @sudipto68

I think that this problem was the result of some inaccurate default settings in default config file. See: https://github.com/backdrop-contrib/domain/issues/19

@yorkshire-pudding See if this is still a problem.

yorkshire-pudding commented 6 months ago

I think this is now fixed.