CommentFileSizeAuthor
#92 user-ng-methods-2017207-87-bc-removal.patch27.18 KBberdir
#92 user-ng-methods-2017207-87-bc-removal-interdiff.txt2.7 KBberdir
#87 user-ng-methods-2017207-87-bc-removal.patch28.08 KBberdir
#87 user-ng-methods-2017207-87-bc-removal-interdiff.txt2.74 KBberdir
#80 user-ng-methods-2017207-80-bc-removal.patch25.63 KBberdir
#80 user-ng-methods-2017207-80-bc-removal-tests-only.patch23.13 KBberdir
#79 user-methods-2017207-79.patch193.02 KBberdir
#78 user-ng-methods-2017207-77.patch181.47 KBberdir
#78 user-ng-methods-2017207-77-bc-removal.patch193.01 KBberdir
#78 user-ng-methods-2017207-77-interdiff.txt36.15 KBberdir
#78 user-ng-methods-2017207-77-bc-removal-interdiff.txt14.83 KBberdir
#74 user-ng-methods-2017207-74.patch162.64 KBberdir
#74 user-ng-methods-2017207-74-interdiff.txt501 bytesberdir
#72 user-ng-methods-2017207-72.patch162.41 KBberdir
#72 user-ng-methods-2017207-72-bc-removal.patch165.79 KBberdir
#72 user-ng-methods-2017207-72-interdiff.txt882 bytesberdir
#70 user-ng-methods-2017207-70.patch161.55 KBberdir
#70 user-ng-methods-2017207-70-bc-removal.patch164.93 KBberdir
#70 user-ng-methods-2017207-70-interdiff.txt10.89 KBberdir
#70 user-ng-methods-2017207-70-bc-removal-interdiff.txt4.13 KBberdir
#68 user-ng-methods-2017207-68.patch154.79 KBberdir
#66 user-ng-methods-2017207-66-interdiff.txt7.29 KBberdir
#66 user-ng-methods-2017207-66.patch156.42 KBberdir
#64 user-ng-methods-2017207-64.patch152.24 KBberdir
#64 user-ng-methods-2017207-64-bc-removal.patch153.98 KBberdir
#62 user-ng-methods-2017207-62.patch317.6 KBberdir
#62 user-ng-methods-2017207-62-bc-removal.patch320.06 KBberdir
#60 user-ng-methods-2017207-60.patch311.67 KBberdir
#60 user-ng-methods-2017207-bc-removal-60.patch313.42 KBberdir
#60 user-ng-methods-2017207-60-interdiff.txt121.6 KBberdir
#59 user-uid-to-methods-2017207-59.patch236.59 KBberdir
#59 user-uid-to-methods-2017207-59-interdiff.txt5.84 KBberdir
#57 user-uid-to-methods-2017207-57.patch288.37 KBberdir
#57 user-uid-to-methods-2017207-57-interdiff.txt2.19 KBberdir
#53 user-uid-to-methods-2017207-53.patch287.2 KBberdir
#51 user-uid-to-methods-2017207-51.patch287.2 KBberdir
#51 user-uid-to-methods-2017207-51-interdiff.txt490 bytesberdir
#49 user-uid-to-methods-2017207-49.patch287.2 KBberdir
#49 user-uid-to-methods-2017207-49-for-review.patch233.59 KBberdir
#47 user-account-interface-2017207-47.patch50.78 KBberdir
#47 user-account-interface-2017207-47-interdiff.txt1.06 KBberdir
#45 user-account-interface-2017207-45.patch50.71 KBberdir
#45 user-account-interface-2017207-45-interdiff.txt3.18 KBberdir
#40 user-account-interface-2017207-40.patch48.46 KBberdir
#40 user-account-interface-2017207-40-interdiff.txt6.68 KBberdir
#38 user-account-interface-2017207-38.patch43.58 KBberdir
#29 user-account-interface-2017207-29.patch275.85 KBmarcingy
#29 inter-diff.txt246.48 KBmarcingy
#27 inter-diff.txt247.09 KBmarcingy
#27 user-account-interface-2017207-27.patch276.45 KBmarcingy
#25 user-account-interface-2017207-25.patch276.44 KBmarcingy
#25 inter-diff.txt247.07 KBmarcingy
#23 user-account-interface-2017207-23.patch276.42 KBmarcingy
#23 inter-diff.txt247.06 KBmarcingy
#21 user-account-interface-2017207-21.patch46.8 KBmarcingy
#21 inter-diff.txt5.05 KBmarcingy
#19 user-account-interface-2017207-18.patch42.39 KBmarcingy
#19 inter-diff.txt1.93 KBmarcingy
#18 user-account-interface-2017207-18.patch42.39 KBmarcingy
#18 inter-diff.txt1.93 KBmarcingy
#16 user-account-interface-2017207-15.patch41.11 KBmarcingy
#16 inter-diff.txt9.61 KBmarcingy
#14 user-account-interface-2017207-14.patch41.07 KBmarcingy
#14 inter-diff.txt9.58 KBmarcingy
#12 user-account-interface-2017207-12.patch40.99 KBmarcingy
#12 inter-diff.txt12.97 KBmarcingy
#10 user-account-interface-2017207-10.patch39.65 KBberdir
#10 user-account-interface-2017207-10-interdiff.txt3.93 KBberdir
#8 user-account-interface-2017207-8.patch36.25 KBberdir
#8 user-account-interface-2017207-8-interdiff.txt1.83 KBberdir
#6 user-account-interface-2017207-6.patch34.42 KBberdir
#6 user-account-interface-2017207-6-interdiff.txt1004 bytesberdir
#4 user-account-interface-2017207-4.patch35.23 KBberdir
#4 user-account-interface-2017207-4-interdiff.txt1.42 KBberdir
#2 user-account-interface-2017207-2.patch35.06 KBberdir

Comments

berdir’s picture

Title: Complete conversion of users to NG » Complete conversion of users to Entity Field API
berdir’s picture

Status: Active » Needs review
StatusFileSize
new35.06 KB

Starting with this.

Adding lots of methods, starting to convert some code...

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-2.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new1.42 KB
new35.23 KB

Ups.

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-4.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new1004 bytes
new34.42 KB

More weird things.

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-6.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new1.83 KB
new36.25 KB

Upgrade path isn't using UserSession yet.

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-8.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new3.93 KB
new39.65 KB

More fixes. The crazy things we put into theme('username')... dblogs?!

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-10.patch, failed testing.

marcingy’s picture

Status: Needs work » Needs review
StatusFileSize
new12.97 KB
new40.99 KB

Fixes up dlog hopefully and re-rolls after some core changes

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-12.patch, failed testing.

marcingy’s picture

StatusFileSize
new9.58 KB
new41.07 KB

Ok hopefully this fixes the dblog tests for real this time, the issue was the dblog test

$this->drupalLogin($this->big_user);
// Delete the user created at the start of this test.
// We need to POST here to invoke batch_process() in the internal browser.
$this->drupalPost('user/' . $user->uid . '/cancel', array('user_cancel_method' => 'user_cancel_reassign'), t('Cancel account'));

So we can't load the user.

marcingy’s picture

Status: Needs work » Needs review
marcingy’s picture

StatusFileSize
new9.61 KB
new41.11 KB

Small tweak to id()/uid detection logic

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-15.patch, failed testing.

marcingy’s picture

Status: Needs work » Needs review
StatusFileSize
new1.93 KB
new42.39 KB

Fixing up node revision tests

marcingy’s picture

StatusFileSize
new1.93 KB
new42.39 KB

Fixing up node revision tests

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-18.patch, failed testing.

marcingy’s picture

Status: Needs work » Needs review
StatusFileSize
new5.05 KB
new46.8 KB

Some more fixes in the area of languages tests.

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-21.patch, failed testing.

marcingy’s picture

Status: Needs work » Needs review
StatusFileSize
new247.06 KB
new276.42 KB

Re-roll and converting references to uid to id() where appropriate. Locally I had a certain number of tests passing which hopefully means that I haven't done anything totally stupid in the conversion. I am sure the bot might think otherwise!

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-23.patch, failed testing.

marcingy’s picture

Status: Needs work » Needs review
StatusFileSize
new247.07 KB
new276.44 KB

Doh

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-25.patch, failed testing.

marcingy’s picture

Status: Needs work » Needs review
StatusFileSize
new276.45 KB
new247.09 KB

And sigh

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-27.patch, failed testing.

marcingy’s picture

Status: Needs work » Needs review
StatusFileSize
new246.48 KB
new275.85 KB

Reverting part of the change tat is preventing install

Status: Needs review » Needs work
Issue tags: -Field API NG blocker

The last submitted patch, user-account-interface-2017207-29.patch, failed testing.

das-peter’s picture

@marcingy I doubt the re-roll worked, #21 patch size 46.8 KB re-rolled (#23) patch size 276.42 KB that doesn't look right.
Will you give it another shot or shall I try my luck? :)

berdir’s picture

The re-roll is fine, the patch just changed uid to id() in all of core. I'm not sure if we want to do that in the initial patch, my idea was to just get the interface and classes in, with a few example conversions in e.g. user.module. Otherwise this patch is going to get insanely big.

das-peter’s picture

I'd prefer a two step approach - I really was like "what the heck" once I noticed the size change.
For reviewing it's, in my eyes, better to have a patch where we can say - no functional changes, search and replacement only.
Maybe we don't need a second issue for that but simply split the patch here(?)

berdir’s picture

Yes, I'm +1 on not replacing everything here/in the first step. The node issue was changed to a meta issue, maybe we should do this here too and then split it up per module or groups of modules? Then we could make novice issues out of probably and get them in in parallel. An alternative would be to split it up per field (uid, status, ...) but I think that has a much higher chance of conflicting.

andypost’s picture

+1 to split

marcingy’s picture

I agree about splitting as by the time I did the coversion of all the uid I was yhinking oh dear. In that case the patch in #21 is where we want to re-roll from.

andypost’s picture

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new43.58 KB

This is a re-roll of #21.

A lot of additional methods on User, so shuffling things around a bit to get a clean diff there...

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-38.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new6.68 KB
new48.46 KB

Not exactly sure yet what to do with user_form_name(), but for now, I had to add getUsername() and also convert a bunch of cases in node.module and elswhere that still passed non-user thingies into that theme function. That just doesn't fly anymore now that we rely on ->id(), it probably used the node id there or something like that...

Status: Needs review » Needs work
Issue tags: -Entity Field API

The last submitted patch, user-account-interface-2017207-40.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +Entity Field API

The last submitted patch, user-account-interface-2017207-40.patch, failed testing.

berdir’s picture

Issue tags: +Field API NG blocker

Tagging.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new3.18 KB
new50.71 KB

Untested attempt to fix those tests.

Status: Needs review » Needs work

The last submitted patch, user-account-interface-2017207-45.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new1.06 KB
new50.78 KB

This should be better :)

That said, that should obviously be an EFQ query, but that's a different story...

berdir’s picture

Title: Complete conversion of users to Entity Field API » [meta] Complete conversion of users to Entity Field API
Status: Needs review » Active

Opened #2026347: Adding methods to UserInterface/AccountInterface and re-uploaded the same patch there, changing this to a meta issue.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new233.59 KB
new287.2 KB

To get this started, here is a first patch that converts ->uid to ->id() and some isAnonymous()/isAuthenticated().

First patch includes the refeferenced issue above to have it tested.

Status: Needs review » Needs work

The last submitted patch, user-uid-to-methods-2017207-49-for-review.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new490 bytes
new287.2 KB

Better?

Status: Needs review » Needs work

The last submitted patch, user-uid-to-methods-2017207-51.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new287.2 KB

So in the first step of the installer, we don't even have a global user object? ... Interesting...

berdir’s picture

Issue tags: +sprint
berdir’s picture

Priority: Normal » Critical

Needs to happen, so critical.

Status: Needs review » Needs work

The last submitted patch, user-uid-to-methods-2017207-53.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new2.19 KB
new288.37 KB

Fixed the roles test and the admin overview, just reverted the change there, there are other patches that clean that function up.

Status: Needs review » Needs work

The last submitted patch, user-uid-to-methods-2017207-57.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new5.84 KB
new236.59 KB

The other issue went in, re-roll and fixing the last test fails, assuming that I didn't make any mistakes.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new121.6 KB
new313.42 KB
new311.67 KB

Opened an issue for the ->uid changes: #2039199: Convert ->uid to ->id(), isAnonymous() and isAuthenticated(), please review and RTBC to get the next piece in.

In the meantime, similar to the node issue, here's a patch that converts more fields and also a version of the patch removes the BC decorator to see how well that's working already.

Edit: Fixed issue reference.

Status: Needs review » Needs work

The last submitted patch, user-ng-methods-2017207-bc-removal-60.patch, failed testing.

berdir’s picture

This should be better.

Status: Needs review » Needs work

The last submitted patch, user-ng-methods-2017207-62-bc-removal.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new153.98 KB
new152.24 KB

Re-roll and some test fixes after the ->uid patch got in.

Status: Needs review » Needs work

The last submitted patch, user-ng-methods-2017207-64-bc-removal.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new156.42 KB
new7.29 KB

Fixed some timezone and access issues.

Status: Needs review » Needs work

The last submitted patch, user-ng-methods-2017207-66.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new154.79 KB

Ah, found the major problem there, accidentally already had some BC stuff that I dropped in the wrong commit.

Status: Needs review » Needs work

The last submitted patch, user-ng-methods-2017207-68.patch, failed testing.

berdir’s picture

Another really stupid mistake ;)

- Fixed missing return for isActive()
- Fixed weird drupalLogin() code (yeah, we're testing this ~10 times, with 4x duplicated code)
- Converted the user password hashing test to DUBT. either that or a phpunit test with mocking, but that felt like a bigger change.

BC Removal interdiff is still trivial, the previous changes should have fixed a lot of those fails too.

Status: Needs review » Needs work

The last submitted patch, user-ng-methods-2017207-70-bc-removal.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new882 bytes
new165.79 KB
new162.41 KB

Buh.

Status: Needs review » Needs work

The last submitted patch, user-ng-methods-2017207-72-bc-removal.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new501 bytes
new162.64 KB

Another crazy bug in getSignature() of the bc decorator, this should be green, so the next question is, how to get it in/split it up. There are some non-trivial changes in there... I can provide patches per method in the order I have them in my commits, re-ordering would be a bit ugly...

* 021613b - Convert ->access/->timestamp to getLastAccessedTime()
* 8efcc26 - Convert ->timezone to methods
* 767a225 - fix password hashing test
* 09f09a0 - convert ->pass to getPassword()
* 3539cda - Converted user signature methods
* e961ecf - Change ->roles to getRoles()
* 470e34d - Replace ->name with methods
* b52d7bb - ->created to ->getCreatedTime()
* b2441c5 - ->login to getLastLoginTime()
* 106311f - Convert ->mail to getEmail()
* 532fdd0 - converted ->status to methods

Edit: order is inversed, bottom is first.

aspilicious’s picture

Splitting this in 10 issues would slow things down :s. I prefer this one to be committed at once. I'm tempted to rtbc this as I reviewed the entire patch but I'm not sure what alex, catch or webchick thinks...

berdir’s picture

+++ b/core/includes/session.incundefined
@@ -113,23 +113,23 @@ function _drupal_session_read($sid) {
   elseif ($user) {
     // The user is anonymous or blocked. Only preserve two fields from the
     // {sessions} table.
     $account = drupal_anonymous_user();
-    $account->session = $user->session;
-    $account->timestamp = $user->timestamp;
+    $account->setSessionData($user->getSessionData());
+    $account->setLastAccessedTime($user->getLastAccessedTime());
     $user = $account;
   }
   else {
     // The session has expired.
     $user = drupal_anonymous_user();
-    $user->session = '';
+    $user->setSessionData(array());

I think we should replace drupal_anonoymous_user() with a new UserSession() here. The two set methods aren't part of the AccountInterface method, I had to add them to UserSesssion to be able to write the now protected properties. But drupal_anonymous() user is documented to return AccountInterface..

+++ b/core/includes/session.incundefined
@@ -177,7 +177,7 @@ function _drupal_session_write($sid, $value) {
-    if ($is_changed || !isset($user->timestamp) || REQUEST_TIME - $user->timestamp > settings()->get('session_write_interval', 180)) {
+    if ($is_changed || !$user->getLastAccessedTime() || REQUEST_TIME - $user->getLastAccessedTime() > settings()->get('session_write_interval', 180)) {

@@ -214,7 +214,7 @@ function _drupal_session_write($sid, $value) {
     // Likewise, do not update access time more than once per 180 seconds.
-    if ($user->isAuthenticated() && REQUEST_TIME - $user->access > settings()->get('session_write_interval', 180)) {
+    if ($user->isAuthenticated() && REQUEST_TIME - $user->getLastAccessedTime() > settings()->get('session_write_interval', 180)) {

It looks like global user has two different properties... ->timestamp and ->access, which are basically the same from what I understand, I replaced them with the same logic/method and it *seems* to work fine.

+++ b/core/lib/Drupal/Core/Password/PasswordInterface.phpundefined
@@ -32,13 +34,13 @@ public function hash($password);
-   * @return bolean.
+   * @return boolean.

That "." here is weird, already fixed the typo, will remove that too.

+++ b/core/lib/Drupal/Core/Session/AccountInterface.phpundefined
@@ -114,4 +114,30 @@ public function getPreferredAdminLangcode($default = NULL);
+  public function getEmail();
...
+  public function getTimeZone();
...
+  public function getLastAccessedTime();

These methods were moved from UserInterface to AccountInterface, as they reflect usage in our current code. We could alternatively also don't do this and require the code to do a user_load(), at least for timezone and e-mail, but the access is required.

+++ b/core/modules/system/lib/Drupal/system/Tests/System/PasswordHashingTest.phpundefined
@@ -7,13 +7,21 @@
-class PasswordHashingTest extends UnitTestBase {
+class PasswordHashingTest extends DrupalUnitTestBase {

There's a separate issue to make this a phpunit test, then we could use mocking, but previously, this passed in stdClass objects, so we need to use DUBT here.

+++ b/core/modules/system/system.moduleundefined
@@ -2413,9 +2414,9 @@ function system_form_user_register_form_alter(&$form, &$form_state) {
-function system_user_presave($account) {
+function system_user_presave(UserInterface $account) {
   $config = config('system.timezone');
-  if ($config->get('user.configurable') && empty($account->timezone) && !$config->get('user.default')) {
+  if ($config->get('user.configurable') && !$account->getTimeZone() && !$config->get('user.default')) {
     $account->timezone = $config->get('default');
   }

As pointed out before, system.module altering the user form is just crazy, we should move this in a follow-up issue.

+++ b/core/modules/user/lib/Drupal/user/Plugin/Action/BlockUser.phpundefined
@@ -27,11 +27,11 @@ class BlockUser extends ActionBase {
   public function execute($account = NULL) {
     // Skip blocking user if they are already blocked.
-    if ($account !== FALSE && $account->status->value == 1) {
+    if ($account !== FALSE && $account->isActive()) {

No idea why action plugins can receive NULL and why it has to do a type safe check to FALSE (which will actually never be TRUE as entity_load() now returns NULL.

Seems like a trick to use ExecutableInterface, which doesn't have any arguments?

+++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.phpundefined
@@ -50,10 +50,10 @@ function testUserCancelWithoutPermission() {
-    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->getLastLoginTime()));

Oh, there's still a ->pass here, a few actually in these tests.

alexpott’s picture

+++ b/core/includes/bootstrap.incundefined
@@ -1898,8 +1898,8 @@ function drupal_get_user_timezone() {
+  if ($user && $config->get('user.configurable') && $user->id() && $user->getTimezone()) {
+    return $user->getTimezone();
   }

Wouldn't this be better...

  if ($user && $config->get('user.configurable') && $user->isAuthenticated() && ($user_timezone = $user->getTimezone())) {
    return $user_timezone;
   }
berdir’s picture

Ok, lots of additional method conversions that should fix most of the failing test with the NG patch, updating to use isAuthenticated() for the above, and various additional removed getBCEntity().

Let's see how this looks.

berdir’s picture

StatusFileSize
new193.02 KB

Posted a re-rolled method conversion patch in #2045275: Convert user properties to methods, please review.

Yay and kinda surprised at the NG patch being green. That's the one that also needs manual testing I think, and I'm quite sure that at least the overlay and contact settings are broken now, as the form controller doesn't set arbitrary stuff on the user objects anymore. So I think it makes sense to test and review that separately.

berdir’s picture

Ok, we're getting close here.

Re-rolled, removed UserBCDecorator class. Wrote tests for the overlay and contact user settings and fixed those form alters by switching to a form submit callback. There would be a fancier way using computed, defined fields based on user.data, but that's a much bigger change...

Status: Needs review » Needs work

The last submitted patch, user-ng-methods-2017207-80-bc-removal-tests-only.patch, failed testing.

plach’s picture

Status: Needs work » Needs review
berdir’s picture

Ok, passed as expected.

What I think this needs now is a fair amount of manual testing. As visible in the missing test coverage, our tests aren't perfect, so it's quite possible that we're missing stuff.

So test this locally or on simplytest.me and then do stuff with users. Create, edit and make sure all settings, passwording changing and so on works, add fields, mass-operations, create views, that list users, stuff like that.

kiphaas7’s picture

Tested on simplytest.me. Tried the following stuff:

Changing passwords on admin account (the account I was logged in with) gave me this error (password was changed succesfully though) :

Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'rid' cannot be null: INSERT INTO {users_roles} (uid, rid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => ) in Drupal\Core\Entity\DatabaseStorageControllerNG->save() (line 404 of /home/se48a55480dac0ce/www/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php).

  • Creating new user: succes (no errors). Editing new user password as admin: succes (no errors).
  • Created a new field (date) for users. Filled this in for both new user and my admin account. Saved and no errors (succes!).
  • Created a very simple view listing users -> saved succesfully, displays correctly.
  • Mass-added the administrator role to both admin account and new users. Works. Removed the administrator role from the new user via his account page, works.
berdir’s picture

Thanks for testing. I can't reproduce that error, can you provide more specific steps on what you filled out where exactly and how your role selection looks like?

kiphaas7’s picture

Apparently, this only goes wrong if form validation fails. If you fill in all the fields correctly without forgetting to fill in a required field it works fine.

Steps to reproduce (I managed to reproduce this several times now):

  1. created sandbox at simplytest.me with your patch (standard profile install, english).
  2. left everything default on configure site
  3. went to edit profile (/#overlay=user/1/edit)
  4. fill in the 'password' and 'confirm password' fields WITHOUT filling in the 'current password' field
  5. get a legitimate FAPI error that you should fill in your current password
  6. fill all three fields (current password, password, confirm password)
  7. password is set, but gives the aforementioned error
berdir’s picture

Thanks, got it. Very ugly bug related to serialization of the entity form controller, we didn't massage the role ids in case of a validation error and re-submit.

Tried, but wasn't able to reproduce the bug with a test so far. Somehow it doesn't break there.

Also removed the new useless clean form state function call, as we only save things which are defined fields anyway.

kiphaas7’s picture

#87: can confirm via manual testing (#86) (simplytest.me) that I don't get the error anymore mentioned in #84.

Yay! :)

amateescu’s picture

Component: node system » user system
Status: Needs review » Reviewed & tested by the community

I also clicked around the UI like crazy, testing the overlay, personal contact form, signatures, various user registration settings and I didn't see any failures. I think it's ready to go.

berdir’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Couple of very minor nits...

+++ b/core/modules/user/lib/Drupal/user/AccountFormController.phpundefined
@@ -7,13 +7,13 @@
    * Overrides Drupal\Core\Entity\EntityFormController::form().

Lets make this {@inheritdoc} as this is the current standard and we now override EntityFormController::form()

+++ b/core/modules/user/lib/Drupal/user/Tests/UserEditTest.phpundefined
@@ -27,7 +27,7 @@ public static function getInfo() {
-    $user1 = $this->drupalCreateUser(array('change own username'));
+    $user1 = $this->drupalCreateUser(array('change own username', 'administer permissions'));

Let's revert this as I can't see why this user actually requires this permission.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new2.7 KB
new27.18 KB

Fixed all Overrides that were part of the patch context, removed the incomplete test changes.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/user/user.moduleundefined
@@ -604,7 +598,8 @@ function user_validate_current_pass(&$form, &$form_state) {
+    $current_value = $account->getPropertyDefinition($key) ? $account->get($key)->value : $account->$key;

I was stumbling upon that, but realized that this is described pretty good by the previous comment.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 57dc876 and pushed to 8.x. Thanks!

I don't think we need to update any change notices here... but I might be wrong.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

berdir’s picture

Issue tags: -sprint

Removing sprint tag.