ワンクリックで
drupal-access
Drupal access control — permissions.yml, access callbacks, AccessResult, custom access checkers, and entity access.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Drupal access control — permissions.yml, access callbacks, AccessResult, custom access checkers, and entity access.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
HTMX in Drupal 11.3+ core — the Htmx PHP fluent builder, dynamic forms with swapOob, partial routes with _htmx_route, response headers, and Drupal.behaviors integration. Use when building interactive UI without full-page reloads using Drupal's native HTMX support.
DDEV local development expertise. Use when working with DDEV projects, containers, configuration, or troubleshooting DDEV environments.
Custom Docker Compose local development patterns. Use when working with Docker-based local environments, container configuration, or troubleshooting Docker setups.
Drupal Cache API — cache tags, contexts, max-age, cache bins, invalidation, and adding cache metadata to render arrays.
Drupal Composer management — requiring modules, updates, patches via composer-patches, and version constraints.
Drupal configuration management with Drush — import/export config, preview config changes before applying (e.g., seeing what would change without importing), config splits, and environment syncing.
| name | drupal-access |
| description | Drupal access control — permissions.yml, access callbacks, AccessResult, custom access checkers, and entity access. |
administer my module:
title: 'Administer My Module'
restrict access: true
view my content:
title: 'View My Content'
requirements:
_permission: 'administer my module' # Permission check
_role: 'administrator' # Role check
_custom_access: '\Drupal\my_module\Access\MyAccessCheck::access'
_entity_access: 'node.update'
_access: 'TRUE'
namespace Drupal\my_module\Access;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Access\AccessResultInterface;
use Drupal\Core\Routing\Access\AccessInterface;
use Drupal\Core\Session\AccountInterface;
final class MyAccessCheck implements AccessInterface {
public function access(AccountInterface $account): AccessResultInterface {
if ($account->hasPermission('administer site configuration')) {
return AccessResult::allowed()->cachePerPermissions();
}
if ($account->hasPermission('view my content')) {
return AccessResult::allowed()->cachePerPermissions();
}
return AccessResult::forbidden()->cachePerPermissions();
}
}
AccessResult::allowed();
AccessResult::forbidden();
AccessResult::neutral();
AccessResult::allowedIf($condition);
AccessResult::forbiddenIf($condition);
AccessResult::allowedIfHasPermission($account, 'my permission');
// Cache correctly
$result->cachePerPermissions(); // Varies by user permissions
$result->cachePerUser(); // Varies by user identity
$result->addCacheableDependency($node); // Varies by entity
$result->setCacheMaxAge(0); // Not cacheable
$node->access('view', $account);
$node->access('update', $account);
$account->hasPermission('administer content');
$account->hasRole('editor');
#[Hook('node_access')]
public function nodeAccess(NodeInterface $node, string $op, AccountInterface $account): AccessResultInterface {
if ($op === 'view' && $node->bundle() === 'private') {
return AccessResult::forbiddenIf(
!$account->hasPermission('view private content')
)->cachePerPermissions()->addCacheableDependency($node);
}
return AccessResult::neutral();
}