Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Status: Active » Needs review
FileSize
4.53 KB

Untested patch.

Gábor Hojtsy’s picture

Issue tags: +Needs tests

Status: Needs review » Needs work

The last submitted patch, edit-check-access.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
768 bytes
4.84 KB

Wups, forgot to update static create.

Status: Needs review » Needs work

The last submitted patch, type-alter-hook-4.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
4.25 KB
5.48 KB

Inject router, pass on route to be able to find the route for the path.

Status: Needs review » Needs work

The last submitted patch, edit-check-access-6.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
2.42 KB
5.95 KB

It helps if I inject all the needed services. Also pretty ridiculous that I need to inject so much to check access to paths :/

Gábor Hojtsy’s picture

Issue tags: -Needs tests
FileSize
7.13 KB
13.08 KB

With specific tests for edit access checking. On site information page and contact category translation page, so both regular config and config entities are covered. The later also has dynamic parts on the URI, so tests that this works with params.

Status: Needs review » Needs work

The last submitted patch, edit-check-access-9.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
12.93 KB
2.35 KB

It was failing not because the edit link was showing up but because the edit link is a prefix to the fuller translation links to the xpath matched given its use of contains(@href...). I was thinking about checking more specific links, but then it may match the breadcrumb still :D So with more concrete checking on the Edit link done in situations when there are no translations to edit (only to add), we can more precisely target this situation and properly ensure this link will not be there. Works for me :)

Gábor Hojtsy’s picture

Status: Needs review » Fixed

Committed this one :)

tstoeckler’s picture

Status: Fixed » Needs work
+++ b/lib/Drupal/config_translation/Controller/ConfigTranslationController.php
@@ -129,15 +169,24 @@ class ConfigTranslationController extends ControllerBase implements ContainerInj
+        $route_request = $this->getRequestForPath($request, $path);
+        $route_name = $route_request->attributes->get(RouteObjectInterface::ROUTE_NAME);

@@ -180,4 +229,35 @@ class ConfigTranslationController extends ControllerBase implements ContainerInj
+    catch (NotFoundHttpException $e) {
+      return NULL;
+    }
+    catch (ResourceNotFoundException $e) {
+      return NULL;
+    }

I think we either need to bubble up the exception (i.e. not catch it) or do a if (!empty($route_request)) above.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
1.52 KB

Yeah. The method was directly taken from the breadcrumb code, so I'd keep it as close to that as makes sense. Modifying the caller then. (Also theoretically the base route will always be there, since we base the translation tab on the edit path, but you never know :)

Gábor Hojtsy’s picture

Status: Needs review » Fixed

Committed that, thanks for the review :)

tstoeckler’s picture

Thanks!

Status: Fixed » Closed (fixed)

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