Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
user system
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Jun 2013 at 19:12 UTC
Updated:
29 Jul 2014 at 22:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
berdirComment #2
berdirStarting with this.
Adding lots of methods, starting to convert some code...
Comment #4
berdirUps.
Comment #6
berdirMore weird things.
Comment #8
berdirUpgrade path isn't using UserSession yet.
Comment #10
berdirMore fixes. The crazy things we put into theme('username')... dblogs?!
Comment #12
marcingy commentedFixes up dlog hopefully and re-rolls after some core changes
Comment #14
marcingy commentedOk hopefully this fixes the dblog tests for real this time, the issue was the dblog test
So we can't load the user.
Comment #15
marcingy commentedComment #16
marcingy commentedSmall tweak to id()/uid detection logic
Comment #18
marcingy commentedFixing up node revision tests
Comment #19
marcingy commentedFixing up node revision tests
Comment #21
marcingy commentedSome more fixes in the area of languages tests.
Comment #23
marcingy commentedRe-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!
Comment #25
marcingy commentedDoh
Comment #27
marcingy commentedAnd sigh
Comment #29
marcingy commentedReverting part of the change tat is preventing install
Comment #31
das-peter commented@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? :)
Comment #32
berdirThe 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.
Comment #33
das-peter commentedI'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(?)
Comment #34
berdirYes, 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.
Comment #35
andypost+1 to split
Comment #36
marcingy commentedI 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.
Comment #37
andypostThe same was done in #1953410: [Meta] Remove field_create_*(), field_update_*() and field_delete_*() in favor of just using the ConfigEntity API for fields
Comment #38
berdirThis 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...
Comment #40
berdirNot 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...
Comment #42
berdir#40: user-account-interface-2017207-40.patch queued for re-testing.
Comment #44
berdirTagging.
Comment #45
berdirUntested attempt to fix those tests.
Comment #47
berdirThis should be better :)
That said, that should obviously be an EFQ query, but that's a different story...
Comment #48
berdirOpened #2026347: Adding methods to UserInterface/AccountInterface and re-uploaded the same patch there, changing this to a meta issue.
Comment #49
berdirTo 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.
Comment #51
berdirBetter?
Comment #53
berdirSo in the first step of the installer, we don't even have a global user object? ... Interesting...
Comment #54
berdirComment #55
berdirNeeds to happen, so critical.
Comment #57
berdirFixed the roles test and the admin overview, just reverted the change there, there are other patches that clean that function up.
Comment #59
berdirThe other issue went in, re-roll and fixing the last test fails, assuming that I didn't make any mistakes.
Comment #60
berdirOpened 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.
Comment #62
berdirThis should be better.
Comment #64
berdirRe-roll and some test fixes after the ->uid patch got in.
Comment #66
berdirFixed some timezone and access issues.
Comment #68
berdirAh, found the major problem there, accidentally already had some BC stuff that I dropped in the wrong commit.
Comment #70
berdirAnother 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.
Comment #72
berdirBuh.
Comment #74
berdirAnother 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...
Edit: order is inversed, bottom is first.
Comment #75
aspilicious commentedSplitting 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...
Comment #76
berdirI 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..
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.
That "." here is weird, already fixed the typo, will remove that too.
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.
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.
As pointed out before, system.module altering the user form is just crazy, we should move this in a follow-up issue.
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?
Oh, there's still a ->pass here, a few actually in these tests.
Comment #77
alexpottWouldn't this be better...
Comment #78
berdirOk, 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.
Comment #79
berdirPosted 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.
Comment #80
berdirOk, 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...
Comment #82
plachComment #83
berdirOk, 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.
Comment #84
kiphaas7 commentedTested 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).Comment #85
berdirThanks 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?
Comment #86
kiphaas7 commentedApparently, 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):
Comment #87
berdirThanks, 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.
Comment #88
kiphaas7 commented#87: can confirm via manual testing (#86) (simplytest.me) that I don't get the error anymore mentioned in #84.
Yay! :)
Comment #89
amateescu commentedI 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.
Comment #90
berdir#87: user-ng-methods-2017207-87-bc-removal.patch queued for re-testing.
Comment #91
alexpottCouple of very minor nits...
Lets make this {@inheritdoc} as this is the current standard and we now override EntityFormController::form()
Let's revert this as I can't see why this user actually requires this permission.
Comment #92
berdirFixed all Overrides that were part of the patch context, removed the incomplete test changes.
Comment #93
dawehnerI was stumbling upon that, but realized that this is described pretty good by the previous comment.
Comment #94
alexpottCommitted 57dc876 and pushed to 8.x. Thanks!
I don't think we need to update any change notices here... but I might be wrong.
Comment #96
berdirRemoving sprint tag.