Commit b07e8f07 authored by alexpott's avatar alexpott

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
......@@ -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');
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment