- Issue created by @aleix
- Status changed to Needs review
over 1 year ago 2:17pm 15 May 2023 - last update
over 1 year ago 5 pass - last update
over 1 year ago 5 pass - πͺπΈSpain aleix
After further testing is better to escape both ":" coming from derivative logic and "." coming from urls, from config ids. So this code I think is better than previous.
- last update
over 1 year ago 5 pass - πͺπΈSpain aleix
As there are no issues with dots coming from urls is better to use dots instead of replacing to "_" as this will lead to issues. For example if the resulting derivative plugin id is
social_auth_gitlab:code.example.com
it will be replaced tosocial_auth_gitlab.code_example_com
, then it will collide with an other instance namedsocial_auth_gitlab:code_example.com
. so this patch is better, and also is tested (functional and manual) and working in this new integration: https://www.drupal.org/project/social_auth_nextcloud β - Status changed to Needs work
over 1 year ago 6:09pm 16 May 2023 - πΊπΈUnited States wells Seattle, WA
Aleix -- thanks for your work on this. A few CRs and one question --
+ // network id filtering the colon that adds plugin derivative system [...] + // network id filtering the colon that adds plugin derivative system
I don't think either of these comments are needed. What's happening here is pretty clear from the method names. If you think there is something worth documenting here these comments can be improved with some more details (I think they are out of date now, anyway?).
+ $network_config = $this->configFactory->get("{$network_id}.settings"); [...] + $this->configFactory->getEditable("{$network_id}.settings")
You don't need to curly-brace variables -- let's change these to use
get("$network_id.settings");
.And looking at your NextCloud implementation I just have one clarifying question: did you end up dropping the idea to use colons? Your
Drupal\social_auth_nextcloud\Form::getEditableConfigNames
method has a seemingly unnecessarystr_replace(".", ".", $network->getDerivativeId());
andDrupal\social_auth_nextcloud\Form::getFormId
hasstr_replace(":", ".", $network->getPluginId());
. Just trying to understand the pattern used. - πͺπΈSpain aleix
Here are the changes suggested.
I am adding it as MR also if you need it.
As for the question. Yes, the colon needs to be removed when defining the config object id, look at this: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Config%21... , so when not replaced, a ConfigNameException is thrown. That's why it needs the patch.
In other places:
- the getEditableConfig: I'll remove this.
- In getFormId, it gets replaced anyway in https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21Fo... . So the more specific name option must be chosen to be able to alter form in a focussed way. - Status changed to Needs review
over 1 year ago 8:20pm 16 May 2023 - last update
over 1 year ago 5 pass - last update
over 1 year ago 5 pass - @aleix opened merge request.
- Status changed to Fixed
over 1 year ago 8:46pm 16 May 2023 - πΊπΈUnited States wells Seattle, WA
All sounds good. Thanks for your work on this!
- πͺπΈSpain aleix
Thank's wells, I released social_auth_nextcloud 4.0.0-rc1 waiting for 10 days to be covered by security advisory policy and then will release stable.
Also added a notice in module homepage to help other multiple url plugin implementation (such as fediverse, gitlab...) developers.
Automatically closed - issue fixed for 2 weeks with no activity.