diff --git a/core/lib/Drupal/Core/Session/SessionHandler.php b/core/lib/Drupal/Core/Session/SessionHandler.php index 08a82a4..7e921c0 100644 --- a/core/lib/Drupal/Core/Session/SessionHandler.php +++ b/core/lib/Drupal/Core/Session/SessionHandler.php @@ -92,7 +92,7 @@ public function read($sid) { // active user. if ($values && $values['uid'] > 0 && $values['status'] == 1) { // Add roles element to $user. - $rids = $this->connection->query("SELECT ur.roles_target_id as rid FROM {user__roles} ur WHERE ur.entity_id = :uid", array( + $rids = $this->connection->query("SELECT ur.roles as rid FROM {user__roles} ur WHERE ur.entity_id = :uid", array( ':uid' => $values['uid'], ))->fetchCol(); $values['roles'] = array_merge(array(DRUPAL_AUTHENTICATED_RID), $rids); diff --git a/core/modules/user/config/install/views.view.user_admin_people.yml b/core/modules/user/config/install/views.view.user_admin_people.yml index 1e1b740..d3e058a 100644 --- a/core/modules/user/config/install/views.view.user_admin_people.yml +++ b/core/modules/user/config/install/views.view.user_admin_people.yml @@ -294,10 +294,10 @@ display: type_custom_false: '' not: '0' plugin_id: boolean - roles_target_id: - id: roles_target_id + roles: + id: roles table: user__roles - field: roles_target_id + field: roles relationship: none group_type: group admin_label: '' @@ -552,7 +552,7 @@ display: user_bulk_form: '0' name: '0' status: '0' - roles_target_id: '0' + roles: '0' created: '0' access: '0' destination: true @@ -649,10 +649,10 @@ display: name: name mail: mail plugin_id: combine - roles_target_id: - id: roles_target_id + roles: + id: roles table: user__roles - field: roles_target_id + field: roles relationship: none group_type: group admin_label: '' @@ -661,11 +661,11 @@ display: group: 1 exposed: true expose: - operator_id: roles_target_id_op + operator_id: roles_op label: Role description: '' use_operator: false - operator: roles_target_id_op + operator: roles_op identifier: role required: false remember: false diff --git a/core/modules/user/src/Plugin/views/field/Roles.php b/core/modules/user/src/Plugin/views/field/Roles.php index cae153c..5e7aaa7 100644 --- a/core/modules/user/src/Plugin/views/field/Roles.php +++ b/core/modules/user/src/Plugin/views/field/Roles.php @@ -79,7 +79,7 @@ public function preRender(&$values) { if ($uids) { $roles = user_roles(); - $result = $this->database->query('SELECT u.entity_id as uid, u.roles_target_id as rid FROM {user__roles} u WHERE u.entity_id IN (:uids) AND u.roles_target_id IN (:rids)', array(':uids' => $uids, ':rids' => array_keys($roles))); + $result = $this->database->query('SELECT u.entity_id as uid, u.roles as rid FROM {user__roles} u WHERE u.entity_id IN (:uids) AND u.roles IN (:rids)', array(':uids' => $uids, ':rids' => array_keys($roles))); foreach ($result as $role) { $this->items[$role->uid][$role->rid]['role'] = String::checkPlain($roles[$role->rid]->label()); $this->items[$role->uid][$role->rid]['rid'] = $role->rid; diff --git a/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php b/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php index c97624e..5d8671b 100644 --- a/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php +++ b/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php @@ -46,8 +46,8 @@ public function testRole() { $view = Views::getView('test_views_handler_field_role'); $this->executeView($view); // The role field is populated during preRender. - $view->field['roles_target_id']->preRender($view->result); - $render = $view->field['roles_target_id']->advancedRender($view->result[0]); + $view->field['roles']->preRender($view->result); + $render = $view->field['roles']->advancedRender($view->result[0]); $this->assertEqual($rolename_b . $rolename_a, $render, 'View test_views_handler_field_role renders role assigned to user in the correct order.'); $this->assertFalse(strpos($render, $rolename_not_assigned), 'View test_views_handler_field_role does not render a role not assigned to a user.'); diff --git a/core/modules/user/src/UserViewsData.php b/core/modules/user/src/UserViewsData.php index 04b1b97..b4f13b3 100644 --- a/core/modules/user/src/UserViewsData.php +++ b/core/modules/user/src/UserViewsData.php @@ -286,7 +286,7 @@ public function getViewsData() { ), ); - $data['user__roles']['roles_target_id'] = array( + $data['user__roles']['roles'] = array( 'title' => t('Roles'), 'help' => t('Roles that a user belongs to.'), 'field' => array( @@ -298,7 +298,7 @@ public function getViewsData() { 'allow empty' => TRUE, ), 'argument' => array( - 'id' => 'user__roles_target_id', + 'id' => 'user__roles', 'name table' => 'role', 'name field' => 'name', 'empty field name' => t('No role'), @@ -316,7 +316,7 @@ public function getViewsData() { ), 'filter' => array( 'id' => 'user_permissions', - 'real field' => 'roles_target_id', + 'real field' => 'roles', ), ); diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml index 372a82d..051c955 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml @@ -90,10 +90,10 @@ display: anonymous_text: '' format_username: true plugin_id: user_name - roles_target_id: - id: roles_target_id + roles: + id: roles table: user__roles - field: roles_target_id + field: roles relationship: none group_type: group admin_label: ''