Steps to reproduce:
Install Drupal, standard profile. Look at the {users} table. UUID is NULL for both. Then create a user via the UI. That one gets a real UUID.

Expected behavior:
The users created during install should also have UUIDs.

Comments

effulgentsia’s picture

Issue tags: +WSCCI

Tagging WSCCI because it results in the HAL output for a node missing the UUID of the author if the author is the root user.

Vasiliy Grotov’s picture

Assigned: Unassigned » Vasiliy Grotov

Will work on this on the weekend.

Vasiliy Grotov’s picture

Status: Active » Needs review
StatusFileSize
new769 bytes

The problem was there is no data provided for UUID by the user.install.

Tested on local - works fine. Let's see what Test bot will say.

berdir’s picture

Status: Needs review » Needs work

This should use the uuid service.

And it's quite crazy that this doesn't use the storage controller...

dawehner’s picture

Issue tags: +Needs tests

This should use the uuid service.

The uuid is not a service yet.

And it's quite crazy that this doesn't use the storage controller...

I agree, maybe some problems with order of bootstrapping in the installer or just some historical reasons.

It would be cool to have a test.

anavarre’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
webchick’s picture

Priority: Normal » Major
Issue summary: View changes

Per anavarre, this is apparently preventing POST requests in REST so seems at least major...

anavarre’s picture

sun’s picture

sun’s picture

Assigned: Vasiliy Grotov » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.26 KB

Attached patch should fix the bug. Still needs two test assertions somewhere. Ideally in an existing installer-specific test.

Status: Needs review » Needs work

The last submitted patch, 12: drupal8.install-uuid.12.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new2.91 KB

The UUID generator is a service now.

luketarplin’s picture

@Berdir You jumped me was just about to release a patch for this using the Drupal::Service method. Just a point you don't need the additional use Drupal\Component\Uuid\Uuid declaration at the top as you are using the Uuid through a Drupal Service not directly! Also it may be better to declare a $uuid = \Drupal::service('uuid'); variable at the top of the install hook and then just use $uuid->generate() instead of making 2 calls to the Drupal Service to get UUID when it is needed.

berdir’s picture

@luketarplin: Sorry :)

Yes, I based my patch on sun's and forgot the remove the use. Feel free to upload your patch :)

berdir’s picture

StatusFileSize
new2.94 KB
new330 bytes

Removed the unecessary use.

sun’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.73 KB

Thanks!

You removed another unnecessary Field use statement there but not the Uuid use statement. However, in general, we should not care for such stuff right now. AFAIK, IDEs like phpStorm are able to perform such a clean-up automatically, across all files. Therefore, we should perform such a clean-up just simply once right before release, instead of holding up patches for it.

Re-uploading the identical patch sans the first hunk in user.install to avoid further delays → RTBC.

anavarre’s picture

Works as expected now, thanks!

mysql> SELECT uid,uuid FROM users;
+-----+--------------------------------------+
| uid | uuid                                 |
+-----+--------------------------------------+
|   1 | 15999b22-8410-4c87-8f00-d32a1da2b892 |
|   0 | 6417b88a-8a12-4e90-8504-4b724c2a791d |
+-----+--------------------------------------+
2 rows in set (0.00 sec)

Hopefully this will unblock #1979260: Automatically populate the author default value with the current user and #2113681: Node author can't be set when posting via HAL

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Great catch.

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

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