Skip to content
Snippets Groups Projects
Commit b07e8f07 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2029471 by amateescu: Fixed Regression: Content types do not respect...

Issue #2029471 by amateescu: Fixed Regression: Content types do not respect all permissions defined by Field UI.
parent 0e0a4079
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -90,14 +90,16 @@ public function buildRow(EntityInterface $entity) {
*/
public function getOperations(EntityInterface $entity) {
$operations = parent::getOperations($entity);
$uri = $entity->uri();
if ($this->moduleHandler->moduleExists('field_ui') && user_access('administer node fields')) {
$uri = $entity->uri();
$operations['manage-fields'] = array(
'title' => t('Manage fields'),
'href' => $uri['path'] . '/fields',
'options' => $uri['options'],
'weight' => 0,
);
}
if ($this->moduleHandler->moduleExists('field_ui') && user_access('administer node display')) {
$operations['manage-display'] = array(
'title' => t('Manage display'),
'href' => $uri['path'] . '/display',
......
......@@ -201,4 +201,27 @@ function testNodeTypeDeletion() {
$this->assertResponse(200);
}
/**
* Tests Field UI integration for content types.
*/
public function testNodeTypeFieldUiPermissions() {
// Create an admin user who can only manage node fields.
$admin_user_1 = $this->drupalCreateUser(array('administer content types', 'administer node fields'));
$this->drupalLogin($admin_user_1);
// Test that the user only sees the actions available to him.
$this->drupalGet('admin/structure/types');
$this->assertLinkByHref('admin/structure/types/manage/article/fields');
$this->assertNoLinkByHref('admin/structure/types/manage/article/display');
// Create another admin user who can manage node fields display.
$admin_user_2 = $this->drupalCreateUser(array('administer content types', 'administer node display'));
$this->drupalLogin($admin_user_2);
// Test that the user only sees the actions available to him.
$this->drupalGet('admin/structure/types');
$this->assertNoLinkByHref('admin/structure/types/manage/article/fields');
$this->assertLinkByHref('admin/structure/types/manage/article/display');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment