Updating User (from user-permissions) with other entities

Hi all.

I came up to a small hurdle using Strapi V4 and connecting entities to the User. ( REST API )

The thing is that I have for an example: favouriteVendor on User with the ( User has more favouriteVendors connection ) and I want to create a vendor and after creation connect it to the User on that key.

I’ve been sifting through the docs and I’ve tried everything to connect a new vendor to the User entity but it simply ignores the update and on the Strapi Admin side I see the Vendor created but the User side favouriteVendors is empty.

What am I missing here? Is there something with the Permissions ( but I’ve set the find and findOne for auth role )?

Any help would be much appreciated and more than welcome. Or even a pointer into the right direction.

Cheers.

This topic has been created from a Discord post (1300858585990959155) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

did you check in the permissions? might be related to that.

you need to update the permissions and add “update” to user-permissions-role

Hi <@267689263246606336> thanks for the response. My user permissions have:

So with the permissions I should be covered. It’s just a pain that the update goes through but no error is thrown if the connection doesn’t get established - or if permissions are missing.

Yeah it’s just silent

Maybe you can put the relation as required, not sure it’s an option though

Hmmm. Well the Admin Panel and the content Type Builder don’t have a setting to make it required. Is there a possibility to configure the user-permissions plugin? All I see in the docs are the config for jwt, registration, validationRules but nothing that would point to all the config properties.

Hmm :thinking: i don’t know about this

I hope the docs get updated with this stuff :smile: And that the user-permissions won’t be so silent :smile:

there might be a way doing it in lifecycle

on a beforeCreate/beforeUpdate

seems you can add manually "required": true on your schema.json file ^^

Thanks for the info. Do you think that it will then let the connection be made?

For anybody trying to get something like this working:

it ain’t perfect I would say but works :smile: