Skip to content

Fix TeamAppAccessHandler::checkCreateAccess() to respect $context array#1267

Open
davidbondor12 wants to merge 2 commits intoapigee:4.xfrom
davidbondor12:issue/1266
Open

Fix TeamAppAccessHandler::checkCreateAccess() to respect $context array#1267
davidbondor12 wants to merge 2 commits intoapigee:4.xfrom
davidbondor12:issue/1266

Conversation

@davidbondor12
Copy link
Copy Markdown

When checking Team App creation access programmatically via the entity access control handler (e.g., $access_handler->createAccess('team_app', $user, ['team' => $team])), the check was incorrectly returning neutral/false. This occurred because checkCreateAccess() ignored the provided $context array and strictly relied on the current URL route containing a {team} parameter.

This breaks access checks for headless architectures, custom REST/JSON:API endpoints, and any custom module that does not use standard Drupal UI routes.

This commit updates TeamAppAccessHandler::checkCreateAccess() to first attempt extracting the team from $context['team'], and only falls back to the route match parameter if the context is empty. It also includes logic to upcast string IDs to Team entities when passed via context.

…ay (apigee#1266)

When checking Team App creation access programmatically via the entity access control handler
(e.g., `$access_handler->createAccess('team_app', $user, ['team' => $team])`), the check was
incorrectly returning neutral/false. This occurred because `checkCreateAccess()` ignored the
provided `$context` array and strictly relied on the current URL route containing a `{team}` parameter.

This breaks access checks for headless architectures, custom REST/JSON:API endpoints, and any
custom module that does not use standard Drupal UI routes.

This commit updates `TeamAppAccessHandler::checkCreateAccess()` to first attempt extracting
the team from `$context['team']`, and only falls back to the route match parameter if the
context is empty. It also includes logic to upcast string IDs to Team entities when passed
via context.
@davidbondor12 davidbondor12 changed the title Fix TeamAppAccessHandler::checkCreateAccess() to respect $context array (#1266) Fix TeamAppAccessHandler::checkCreateAccess() to respect $context array Apr 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.35%. Comparing base (cc91151) to head (e113d06).

Files with missing lines Patch % Lines
...gee_edge_teams/src/Entity/TeamAppAccessHandler.php 0.00% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                4.x    #1267      +/-   ##
============================================
- Coverage     43.53%   42.35%   -1.19%     
  Complexity     3119     3119              
============================================
  Files           345      345              
  Lines         11392    11386       -6     
============================================
- Hits           4959     4822     -137     
- Misses         6433     6564     +131     
Files with missing lines Coverage Δ
...gee_edge_teams/src/Entity/TeamAppAccessHandler.php 0.00% <0.00%> (ø)

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants