-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/group sites #438
Feature/group sites #438
Conversation
Tests now use domains: group-0.{base domain} group-1.{base domain} group-2.{base domain} group-3.{base domain} in place of the previous a1 b1 etc.
Fix admin mode to be on in the control domain at all times.
…tall and uninstall modules)
To test this probably easiest to checkout the More details on upgrade testing on the issue #429 (comment) |
My steps to test:
The install goes fine, but I am having problems with permissions.
It is odd, as I can see the buttons to edit, manage members etc... |
So my hunch that it was something I'd done right at the end was correct. It was my attempt to make the control site permanently in 'group_sites admin mode'. Seems it was reporting that it is in admin mode in the toolbar, a brief check for access control in the debugger also saw it confirming admin mode, but somewhere, I've not found, it was returning an access denied because it wasn't it seems. This means with your site as it stands above you should be able to go to the domain itself, login, and administer the microsite from there. To try and fix this I've now pushed a change that from cursory testing seemed to fix it for me 9c975ba But if that doesn't work for you - quite possible it's just a punt that seems to work - to temporarily disable this all and test everything else:
|
Thanks @ekes - the install is working for me now since that commit 9c975ba If anyone else wants to test this branch, this sets it up quickly for me:
|
I am finally on it. Hopefully should be able to complete the review before Tuesday's Merge Monday meeting :D |
@nccchris it would be great if you could test this against your multiple microsites. |
So Potential steps to test an upgrade: (this needs testing / confirming) Assuming we have an existing installation on Drupal 10, (the 3.x branch of https://github.com/localgovdrupal/localgov_microsites)
|
First of all there's a small typo : I'm probably doing something silly, but I hit a couple of problems. At composer require "localgovdrupal/localgov_microsites:dev-feature/group_sites as 2.1.0-beta6" -W
'Y' allows me to proceed, but then at drush updb I hit an error :
|
@nccchris I'm making a first guess here, but is it possible that the site you're upgrading hadn't yet fully upgraded / |
Note: on my local testing, I can now manage the sites on the control site as a controller. But I cannot see any content on each microsite, I just get access denied. I will re-test from scratch and report steps to reproduce. |
Thanks for the test steps Finn. All works good on a fresh install. I will now try the upgrade path. Drupal logs are getting flooded with PHP 8.2 deprecation notices from the autosave_form module. A patch is available which we may want. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some code was move directly out of domain_group into localgov_microsites_group
If these can be marked as such, that may help for future reference.
"localgovdrupal/localgov_events": "For events content type in microsites" | ||
}, | ||
"extra": { | ||
"enable-patching": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I remember, enable-patching
is only relevant for root level composer.json files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're doing this all over localgov. This is possibly something that could go into clear up with localgovdrupal/localgov#597
Can maybe remove it here already, needs checking though, I think there's some unexpected buggyness with patching from dependencies already.
// Group sites should be installed aleady. It provides configuration, so we | ||
// can't, but must update its default config. | ||
$group_sites = \Drupal::configFactory()->getEditable('group_sites.settings'); | ||
$group_sites->set('context_provider', '@group_context_domain.group_from_domain_context:group'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* The access result. | ||
*/ | ||
protected function accessCreateGroupTerm(AccountInterface $account, GroupInterface $group, string $plugin_id) { | ||
$plugin_manager = \Drupal::service('group_relation_type.manager'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this can also be initialized in GroupTermUiController::create()
.
arguments: ['@domain.negotiator', '@group_sites.admin_mode'] | ||
tags: | ||
- { name: event_subscriber } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be good to have some comments here clarifying the domain_group module as the original source of these services.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -15,3 +15,14 @@ localgov_microsites_group.microsite_admin: | |||
_controller: '\Drupal\localgov_microsites_group\Controller\MicrositeAdminController::redirectToMicrositeAdmin' | |||
requirements: | |||
_custom_access: '\Drupal\localgov_microsites_group\Controller\MicrositeAdminController::access' | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be good to have some comments here clarifying the domain_group module as the original source of this route.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason? There's nothing funky with the namespacing or so in this particular case? And it does now become just how LocalGov Microsites works (or rather has its admin interface).
$form = $this->formBuilder()->getForm(DomainGroupConfigAdd::class, $group, $extra); | ||
// Only create a new domain if we have nothing stored. | ||
if (!$domain = $store->get("$store_id:domain")) { | ||
$values['type'] = $group_type->id(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! You mean specifically line 133
, yer that's a c&p isn't it. 180dc1e
src/DomainGroupResolver.php
Outdated
|
||
if (!empty($groups)) { | ||
foreach ($groups as $group) { | ||
if ($group) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps if ($group implements GroupInterface) {
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guessing checking instanceof would be consistent with the method. 9cfc24f
src/GroupDefaultContent.php
Outdated
@@ -72,6 +62,8 @@ public function generate(GroupInterface $group): ?NodeInterface { | |||
$plugin_id = 'group_node:' . $default->bundle(); | |||
if ($group->getGroupType()->hasPlugin($plugin_id)) { | |||
$node = $this->replicator->replicateEntity($default); | |||
assert($node instanceof Node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert($node instanceof NodeInterface);
perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. 735c4f7
@@ -124,6 +125,7 @@ public function testGroupManagementAccess() { | |||
|
|||
// Test member access. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do group members need access to the Group Domain settings page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah the difference between the two users here is that one is a member with no role but permission to 'use group_sites_admin_mode' permission only, and the other has a 'microsites-admin' role.
/* | ||
// Creating domain site settings. | ||
foreach ($this->allTestGroups as $group) { | ||
$domain_id = 'group_' . $group->id(); | ||
$config_id = 'domain.config.' . $domain_id . '.system.site'; | ||
$config = $this->getConfigFactory()->getEditable($config_id); | ||
$config->set('name', $group->label()); | ||
$config->set('slogan', $group->label() . ' Slogan'); | ||
$config->set('mail', 'group-' . $group->id() . '@user.com'); | ||
$config->set('page.front', '/group/' . $group->id()); | ||
$config->set('page.403', '/denied'); | ||
$config->set('page.404', '/not-found'); | ||
} | ||
$config->save(); | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ⌫ :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested upgrading our example sites from https://demo.microsites.localgovdrupal.org/ I copied the db down locally, installed, then ran the upgrade. After disabling localgov_search_block, and updaing the domains to match the local test domains, I am seeing 'access denied' on all content on all microsites. Even logging in as a 'LocalGov Admin' to site 1, creating a new node (event node in my case) gives access denied to both the logged in 'LocalGov Admin' user and anonymous. @stephen-cox has just replicated the same behaviour on a fresh install of https://github.com/localgovdrupal/localgov_microsites/releases/tag/3.0.0-alpha1, creating a single site, then flipping to this branch and running the updgrade. @Adnan-cds have you tried your upgrade yet and if so, do you get similar results? |
I am at it now. Hoping to get a clear idea by the end of the day. |
Sorry Finn, still working on it. I am having to update our site to Drupal 10 first! That's taking sometime. |
Ah! The upgrade has 'Group from URL' ticked and needs changing to the (correct) group from Domain Fixes on the way, and running through the issues Adnan raises. |
Are the search indexes getting lost. Why are the search indexes getting lost. We're not doing anything to them are we? 😕 |
Just resaving them while both modules domain_group and the upgraded localgov_microsites_group seems good enough.
It'll be because they depend on group_domain because of the plugin (that moves into localgov_microsites_group). Need to update all the dependencies in config and this seems to do it. ad44bea |
OK. I'd say that's ready for review again @stephen-cox @nccchris Oh! And @Adnan-cds I think this might upgrade directly from 2.x you know, it seems I'd forked it from there not 3.x! Tests just done were from 3.x though. |
I was following Finn's update instructions given above. This is what happened at the
This is on a site using localgovdrupal/localgov_microsites:3.0.0-alpha1 with more than one existing microsite. |
Guessing 700cf1a should fix that for you? |
If I do an initial install from #439, create a microsite and run through the upgrade instructions, the upgrade works without any errors. We do need to make the upgrade process as painless as possible. |
I can confirm that following Finn's update instructions results in a successful update and microsites appear to be okay on the updated instance. I have noticed just one error message in the Drupal log: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing has been going well and we discussed this in our tech group meeting yesterday. The general agreement to merge this and tag a 4.x-alpha release to gain visibility and make further testing easier. Nice work on this so far everyone, thank you!
Switches to use group_sites in place of domain_group; and removes dependency on group_permissions switching to controlling access on routes per domain for creating content.