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

Issue #3082006 by id.aleks, cambraca, mr.baileys, sokru, alexpott, larowlan,...

Issue #3082006 by id.aleks, cambraca, mr.baileys, sokru, alexpott, larowlan, longwave: User password field is empty in Views
parent c1548fce
Branches
Tags
8 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards,!16Draft: Resolve #2081585 "History storage",!13Resolve #2903456
......@@ -249,6 +249,10 @@ public function getViewsData() {
],
];
// Unset the "pass" field because the access control handler for the user
// entity type allows editing the password, but not viewing it.
unset($data['users_field_data']['pass']);
return $data;
}
......
<?php
namespace Drupal\Tests\user\Kernel\Views;
use Drupal\KernelTests\KernelTestBase;
/**
* Contains tests related to the views data for the user entity type.
*
* @group user
*
* @see \Drupal\user\UserViewsData
*/
class UserViewsDataTest extends KernelTestBase {
/**
* The views data service.
*
* @var \Drupal\views\ViewsData
*/
protected $viewsData;
/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected $entityFieldManager;
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
'user',
'views',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->viewsData = $this->container->get('views.views_data');
$this->entityFieldManager = $this->container->get('entity_field.manager');
}
/**
* Tests if user views data object doesn't contain pass field.
*/
public function testUserPasswordFieldNotAvailableToViews() {
$field_definitions = $this->entityFieldManager->getBaseFieldDefinitions('user');
$this->assertArrayHasKey('pass', $field_definitions);
$this->assertArrayNotHasKey('pass', $this->viewsData->get('users_field_data'));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment